Skip to content

Commit

Permalink
Fix default loglevel, handle error initialising logging
Browse files Browse the repository at this point in the history
  • Loading branch information
nick42d committed Nov 22, 2024
1 parent 1cf4620 commit b5324e5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions youtui/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,19 @@ fn init_tracing(debug: bool) -> Result<()> {
.with(tui_logger_layer.and_then(log_file_layer))
.with(context_layer)
.init();
tui_logger::init_logger(LevelFilter::Debug);
tui_logger::init_logger(LevelFilter::Debug)
.expect("Expected logger to initialise succesfully");
info!("Started in debug mode, logging to {:?}.", log_file_name);
} else {
// TODO: Confirm if this filter is correct.
let context_layer =
tracing_subscriber::filter::Targets::new().with_target("youtui", tracing::Level::TRACE);
tracing_subscriber::filter::Targets::new().with_target("youtui", tracing::Level::INFO);
tracing_subscriber::registry()
.with(tui_logger_layer)
.with(context_layer)
.init();
tui_logger::init_logger(LevelFilter::Debug);
tui_logger::init_logger(LevelFilter::Info)
.expect("Expected logger to initialise succesfully");
}
Ok(())
}

0 comments on commit b5324e5

Please sign in to comment.