From 43012456ad5f307d329d22f850b0582f67b99ec9 Mon Sep 17 00:00:00 2001 From: matt-hagemann Date: Wed, 8 Nov 2023 16:46:29 +0200 Subject: [PATCH] feat(main): make use of config log-level value --- src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index d0b95df..a144f02 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,8 +6,16 @@ mod utils; async fn main() -> Result<(), Box> { let config = utils::Config::load()?; + let log_level = match config.log_level.as_str() { + "debug" => tracing::Level::DEBUG, + "info" => tracing::Level::INFO, + "warn" => tracing::Level::WARN, + "error" => tracing::Level::ERROR, + _ => tracing::Level::INFO, + }; + tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) + .with_max_level(log_level) .with_span_events(tracing_subscriber::fmt::format::FmtSpan::CLOSE) .init();