diff --git a/Cargo.toml b/Cargo.toml index 5ad7a68..d7d4425 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 6d29b75..c78f9e6 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -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 { @@ -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! {} }