Skip to content

Commit

Permalink
Merge pull request #3859 from stefan0xC/prevent-handlebar-logs
Browse files Browse the repository at this point in the history
filter handlebars logs
  • Loading branch information
dani-garcia authored Oct 8, 2023
2 parents f0c9a7f + f96c5e8 commit 008a2cf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,13 @@ fn init_logging(level: log::LevelFilter) -> Result<(), fern::InitError> {
log::LevelFilter::Off
};

// Only show handlebar logs when the level is Trace
let handlebars_level = if level >= log::LevelFilter::Trace {
log::LevelFilter::Trace
} else {
log::LevelFilter::Warn
};

let mut logger = fern::Dispatch::new()
.level(level)
// Hide unknown certificate errors if using self-signed
Expand All @@ -282,6 +289,8 @@ fn init_logging(level: log::LevelFilter) -> Result<(), fern::InitError> {
.level_for("rocket::shield::shield", log::LevelFilter::Warn)
.level_for("hyper::proto", log::LevelFilter::Off)
.level_for("hyper::client", log::LevelFilter::Off)
// Filter handlebars logs
.level_for("handlebars::render", handlebars_level)
// Prevent cookie_store logs
.level_for("cookie_store", log::LevelFilter::Off)
// Variable level for trust-dns used by reqwest
Expand Down

0 comments on commit 008a2cf

Please sign in to comment.