Add output about logger settings in logging setup
This way we can get trace-level information about the logger itself when it is generated. Because from time to time we might want to have a look at that. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
6681f9fcfd
commit
22c239c212
2 changed files with 8 additions and 1 deletions
|
@ -41,6 +41,7 @@ use libimagerror::errors::ErrorMsg as EM;
|
|||
|
||||
type ModuleName = String;
|
||||
|
||||
#[derive(Debug)]
|
||||
enum LogDestination {
|
||||
Stderr,
|
||||
File(Arc<Mutex<::std::fs::File>>),
|
||||
|
@ -52,6 +53,7 @@ impl Default for LogDestination {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct ModuleSettings {
|
||||
enabled: bool,
|
||||
level: Option<Level>,
|
||||
|
@ -61,6 +63,7 @@ struct ModuleSettings {
|
|||
}
|
||||
|
||||
/// Logger implementation for `log` crate.
|
||||
#[derive(Debug)]
|
||||
pub struct ImagLogger {
|
||||
global_loglevel : Level,
|
||||
|
||||
|
|
|
@ -367,11 +367,15 @@ impl<'a> Runtime<'a> {
|
|||
|
||||
set_max_level(logger.global_loglevel().to_level_filter());
|
||||
|
||||
debug!("Init logger with {}", logger.global_loglevel());
|
||||
// safe debug output for later, after the instance itself
|
||||
// is moved away
|
||||
let logger_expl = format!("{:?}", logger);
|
||||
|
||||
set_boxed_logger(Box::new(logger))
|
||||
.map_err(|e| panic!("Could not setup logger: {:?}", e))
|
||||
.ok();
|
||||
|
||||
trace!("Imag Logger = {}", logger_expl);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue