Skip to content

Commit

Permalink
Merge pull request #29 from matthew-hagemann/set-log-level
Browse files Browse the repository at this point in the history
fix(main): make use of config log-level value
  • Loading branch information
matthew-hagemann authored Nov 15, 2023
2 parents 8a6da19 + 4301245 commit dd3ee06
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 @@ -6,8 +6,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 dd3ee06

Please sign in to comment.