From c53c10cb0a85fcefd569c3f770bfbac4f93bf7ab Mon Sep 17 00:00:00 2001 From: Cappy Ishihara Date: Mon, 3 Jun 2024 01:19:16 +0700 Subject: [PATCH] logger env --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index e5fccae..ab903cc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -102,11 +102,16 @@ async fn health_check() -> String { } +const LOGGER_ENV: &str = "RUST_LOG"; + #[tokio::main] async fn main() -> Result<()> { + // "trace,axum=info,tower_http=info,tokio=info,tungstenite=info,tokio_tungstenite=info", + let logger_env = std::env::var(LOGGER_ENV).unwrap_or_else(|_| "info".into()); + tracing_subscriber::fmt::fmt() .with_env_filter( - "trace,axum=info,tower_http=info,tokio=info,tungstenite=info,tokio_tungstenite=info", + logger_env ) .pretty() .init();