Skip to content

Commit d8361ef

Browse files
Istvan Zolyomiestk
authored andcommitted
Added max_log_level() to log Handle
1 parent 2efd2a1 commit d8361ef

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,7 @@ pub struct Handle {
464464
impl Handle {
465465
/// Sets the logging configuration.
466466
pub fn set_config(&self, config: Config) {
467-
let shared = SharedLogger::new(config);
468-
log::set_max_level(shared.root.max_log_level());
469-
self.shared.store(Arc::new(shared));
467+
self.reconfigure(config, EnvMode::Single)
470468
}
471469

472470
/// Sets the logging configuration with optionally adjusting the global logger settings through the `log`` crate.
@@ -479,6 +477,11 @@ impl Handle {
479477
};
480478
self.shared.store(Arc::new(shared));
481479
}
480+
481+
/// Get the maximum log level according to the current configuration
482+
pub fn max_log_level(&self) -> LevelFilter {
483+
self.shared.load().root.max_log_level()
484+
}
482485
}
483486

484487
/// Logger environment mode used for reconfiguration

0 commit comments

Comments
 (0)