diff options
author | sommerfeld <sommerfeld@sommerfeld.dev> | 2024-04-23 15:54:03 +0100 |
---|---|---|
committer | sommerfeld <sommerfeld@sommerfeld.dev> | 2024-04-23 16:08:56 +0100 |
commit | 3c749a1add53a7eedeed5a95dfe68092bce29c42 (patch) | |
tree | 2aef32315f492b0d25f92d254da2315c3da46077 /src/main.rs | |
parent | 6e0ea248ff2b978754331e59f684a5b7a8d4341d (diff) | |
download | sentrum-3c749a1add53a7eedeed5a95dfe68092bce29c42.tar.gz sentrum-3c749a1add53a7eedeed5a95dfe68092bce29c42.tar.bz2 sentrum-3c749a1add53a7eedeed5a95dfe68092bce29c42.zip |
Allow RUST_LOG to correctly override default
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 6006348..dc9fc72 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,10 +26,12 @@ use crate::{ }; fn set_logger() { - pretty_env_logger::formatted_builder() - .filter_module(env!("CARGO_PKG_NAME"), log::LevelFilter::Info) - .parse_default_env() - .init(); + let mut builder = pretty_env_logger::formatted_builder(); + match std::env::var("RUST_LOG") { + Ok(_) => builder.parse_default_env(), + Err(_) => builder.filter_module(env!("CARGO_PKG_NAME"), log::LevelFilter::Info), + }; + builder.init(); } fn set_signal_handlers() -> Result<()> { |