From 3c749a1add53a7eedeed5a95dfe68092bce29c42 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Tue, 23 Apr 2024 15:54:03 +0100 Subject: Allow RUST_LOG to correctly override default --- src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/main.rs') 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<()> { -- cgit v1.2.3-70-g09d2