Skip to content

Commit

Permalink
Set default log level to WARN
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Mar 7, 2022
1 parent 5a2fdc6 commit 1414ec6
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 @@ -36,8 +36,16 @@ use crate::{
};

fn main() -> anyhow::Result<()> {
// Respect `RUST_LOG`. If that's not defined or erroneous, log warnings and
// above.
//
// It would be better to fail, if `RUST_LOG` is erroneous, but I don't know
// how to distinguish between that and the "not defined" case.
tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env())
.with_env_filter(
EnvFilter::try_from_default_env()
.unwrap_or_else(|_| EnvFilter::new("WARN")),
)
.event_format(format().pretty())
.init();

Expand Down

0 comments on commit 1414ec6

Please sign in to comment.