Skip to content

Commit

Permalink
fix: if both tracing and logging is enabled, funnel logs through tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron authored and d-e-s-o committed Apr 29, 2024
1 parent bc1a8c0 commit eb9a182
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ required-features = ["log", "unstable"]
default = ["log"]
# TODO: use "dep:{tracing-subscriber,evn_logger}" once our MSRV is 1.60 or higher.
trace = ["tracing-subscriber", "test-log-macros/trace"]
log = ["env_logger", "test-log-macros/log"]
log = ["env_logger", "test-log-macros/log", "tracing-subscriber?/tracing-log"]
# Enable unstable features. These are generally exempt from any semantic
# versioning guarantees.
unstable = ["test-log-macros/unstable"]
Expand Down
4 changes: 2 additions & 2 deletions macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl AttributeArgs {


/// Expand the initialization code for the `log` crate.
#[cfg(feature = "log")]
#[cfg(all(feature = "log", not(feature = "trace")))]
fn expand_logging_init(attribute_args: &AttributeArgs) -> Tokens {
let add_default_log_filter = if let Some(default_log_filter) = &attribute_args.default_log_filter
{
Expand All @@ -172,7 +172,7 @@ fn expand_logging_init(attribute_args: &AttributeArgs) -> Tokens {
}
}

#[cfg(not(feature = "log"))]
#[cfg(not(all(feature = "log", not(feature = "trace"))))]
fn expand_logging_init(_attribute_args: &AttributeArgs) -> Tokens {
quote! {}
}
Expand Down

0 comments on commit eb9a182

Please sign in to comment.