Skip to content

Commit

Permalink
set default level of info
Browse files Browse the repository at this point in the history
  • Loading branch information
insipx committed Dec 22, 2023
1 parent 848ca93 commit cce87ee
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions xps-gateway/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ static INIT: Once = Once::new();

pub(crate) fn init_logging() {
let fmt = fmt::layer().compact();
Registry::default()
.with(EnvFilter::from_default_env())
.with(fmt)
.init()
Registry::default().with(env()).with(fmt).init()
}

#[cfg(test)]
#[ctor::ctor]
fn __init_test_logging() {
INIT.call_once(|| {
let fmt = fmt::layer().compact();
Registry::default()
.with(EnvFilter::from_default_env())
.with(fmt)
.init()
Registry::default().with(env()).with(fmt).init()
})
}

/// Try to get the logging environment from the `RUST_LOG` environment variable.
/// If it is not set, use the default of `info`.
fn env() -> EnvFilter {
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"))
}

0 comments on commit cce87ee

Please sign in to comment.