Remove early logging, doesnt work

This commit is contained in:
Matthias Beyer 2015-10-26 21:41:45 +01:00
parent f5bdff434e
commit 1ecb13a8fe

View file

@ -19,26 +19,19 @@ impl ImagLogger {
} }
} }
pub fn early() -> Result<(), SetLoggerError> {
ImagLogger::init_logger(LogLevelFilter::Error)
}
pub fn init(cfg: &Cfg, config: &CliConfig) -> Result<(), SetLoggerError> { pub fn init(cfg: &Cfg, config: &CliConfig) -> Result<(), SetLoggerError> {
if config.is_debugging() || cfg.is_debugging() { let lvl = if config.is_debugging() || cfg.is_debugging() {
ImagLogger::init_logger(LogLevelFilter::Debug) LogLevelFilter::Debug
} else if config.is_verbose() || cfg.is_debugging() { } else if config.is_verbose() || cfg.is_debugging() {
ImagLogger::init_logger(LogLevelFilter::Info) LogLevelFilter::Info
} else { } else {
ImagLogger::init_logger(LogLevelFilter::Error) LogLevelFilter::Error
} };
}
fn init_logger(lvlflt : LogLevelFilter) -> Result<(), SetLoggerError> {
log::set_logger(|max_log_lvl| { log::set_logger(|max_log_lvl| {
max_log_lvl.set(lvlflt); max_log_lvl.set(lvl);
debug!("Init logger with: {}", lvlflt); debug!("Init logger with: {}", lvl);
Box::new(ImagLogger::new(lvlflt.to_log_level().unwrap())) Box::new(ImagLogger::new(lvl.to_log_level().unwrap()))
}) })
} }