-
-
Notifications
You must be signed in to change notification settings - Fork 168
ref(log): send logs by default when logs feature flag is enabled #915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 16 commits
dfb3a39
65f7c97
fb6dc78
79261c2
c5668e7
b79bfd7
e7a8769
0567156
cfbb994
7d96f91
a8a5c4c
979411c
eae136a
0da7c5e
71749b9
53c2165
af75932
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,29 @@ pub enum RecordMapping { | |
/// Captures the [`sentry_core::protocol::Log`] to Sentry. | ||
#[cfg(feature = "logs")] | ||
Log(sentry_core::protocol::Log), | ||
/// Captures multiple items to Sentry. | ||
/// Nesting multiple `RecordMapping::Combined` is not supported and will cause the mappings to | ||
/// be ignored. | ||
Combined(CombinedRecordMapping), | ||
} | ||
|
||
/// A list of record mappings. | ||
#[derive(Debug)] | ||
pub struct CombinedRecordMapping(Vec<RecordMapping>); | ||
|
||
impl From<RecordMapping> for CombinedRecordMapping { | ||
fn from(value: RecordMapping) -> Self { | ||
match value { | ||
RecordMapping::Combined(combined) => combined, | ||
_ => CombinedRecordMapping(vec![value]), | ||
} | ||
} | ||
} | ||
|
||
|
||
impl From<Vec<RecordMapping>> for CombinedRecordMapping { | ||
fn from(value: Vec<RecordMapping>) -> Self { | ||
Self(value) | ||
} | ||
} | ||
|
||
impl From<RecordMapping> for Vec<RecordMapping> { | ||
|
@@ -52,7 +75,13 @@ impl From<RecordMapping> for Vec<RecordMapping> { | |
/// `warning` and `info`, and `debug` and `trace` logs are ignored. | ||
pub fn default_filter(metadata: &log::Metadata) -> LogFilter { | ||
match metadata.level() { | ||
#[cfg(feature = "logs")] | ||
log::Level::Error => LogFilter::Exception | LogFilter::Log, | ||
#[cfg(not(feature = "logs"))] | ||
log::Level::Error => LogFilter::Exception, | ||
#[cfg(feature = "logs")] | ||
log::Level::Warn | log::Level::Info => LogFilter::Breadcrumb | LogFilter::Log, | ||
#[cfg(not(feature = "logs"))] | ||
log::Level::Warn | log::Level::Info => LogFilter::Breadcrumb, | ||
log::Level::Debug | log::Level::Trace => LogFilter::Ignore, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: SentryLogger Fails to Handle Combined RecordMappings
The
SentryLogger::log
method doesn't handle the newRecordMapping::Combined
variant. This means any mappings wrapped within aCombined
variant are silently ignored, preventing logs from being processed and sent to Sentry.