aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/main.rs
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2024-04-23 15:54:03 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2024-04-23 16:08:56 +0100
commit3c749a1add53a7eedeed5a95dfe68092bce29c42 (patch)
tree2aef32315f492b0d25f92d254da2315c3da46077 /src/main.rs
parent6e0ea248ff2b978754331e59f684a5b7a8d4341d (diff)
downloadsentrum-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.rs10
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<()> {