Skip to content

Commit

Permalink
feat(main): make use of config log-level value
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-hagemann committed Nov 8, 2023
1 parent 25b0c16 commit 68a0aac
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ mod utils;
async fn main() -> Result<(), Box<dyn std::error::Error>> {
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();

Expand Down

0 comments on commit 68a0aac

Please sign in to comment.