Use env!("CARGO_CRATE_NAME") in the example to simplify the tracing setup code (#2884)

This commit is contained in:
Weipeng Hong
2024-08-24 08:36:08 +02:00
committed by GitHub
parent bd3eaa7886
commit ef1448a3f5
38 changed files with 70 additions and 50 deletions
@@ -16,7 +16,7 @@ async fn main() {
tracing_subscriber::registry()
.with(
tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| "example_customize_extractor_error=trace".into()),
.unwrap_or_else(|_| format!("{}=trace", env!("CARGO_CRATE_NAME")).into()),
)
.with(tracing_subscriber::fmt::layer())
.init();