Skip to content

Commit

Permalink
Added max_log_level() to log Handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Istvan Zolyomi committed Sep 16, 2024
1 parent 6f019fb commit 0c47233
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,7 @@ pub struct Handle {
impl Handle {
/// Sets the logging configuration.
pub fn set_config(&self, config: Config) {
let shared = SharedLogger::new(config);
log::set_max_level(shared.root.max_log_level());
self.shared.store(Arc::new(shared));
self.reconfigure(config, EnvMode::Single)
}

/// Sets the logging configuration with optionally adjusting the global logger settings through the `log`` crate.
Expand All @@ -479,6 +477,11 @@ impl Handle {
};
self.shared.store(Arc::new(shared));
}

/// Get the maximum log level according to the current configuration
pub fn max_log_level(&self) -> LevelFilter {
self.shared.load().root.max_log_level()
}
}

/// Logger environment mode used for reconfiguration
Expand Down

0 comments on commit 0c47233

Please sign in to comment.