From 44e7ec15279e44c53de5e2340076f174f1cbd30d Mon Sep 17 00:00:00 2001 From: xavo95 Date: Fri, 1 Nov 2024 20:27:31 +0100 Subject: [PATCH] Log improvement --- common/src/logging.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/common/src/logging.rs b/common/src/logging.rs index de76dd5..85c3343 100644 --- a/common/src/logging.rs +++ b/common/src/logging.rs @@ -1,5 +1,4 @@ use tracing::Level; -use tracing_subscriber::fmt::writer::MakeWriterExt; use tracing_subscriber::layer::SubscriberExt; use tracing_subscriber::util::SubscriberInitExt; @@ -17,16 +16,13 @@ pub fn init_axum(max_level: Level) { // axum logs rejections from built-in extractors with the `axum::rejection` // target, at `TRACE` level. `axum::rejection=trace` enables showing those events format!( - "{}=debug,tower_http=debug,axum::rejection=trace", - env!("CARGO_CRATE_NAME") - ) - .into() + "{}={},tower_http={},axum::rejection=trace", + env!("CARGO_CRATE_NAME"), + max_level.as_str(), + max_level.as_str() + ).into() }), ) - .with( - tracing_subscriber::fmt::layer() - .with_writer(std::io::stdout.with_max_level(max_level)) - .with_target(false) - ) + .with(tracing_subscriber::fmt::layer().with_target(false)) .init(); } \ No newline at end of file