From 1ecb13a8fe655a1f59370803dc107ca2d1bce6ad Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 26 Oct 2015 21:41:45 +0100 Subject: [PATCH] Remove early logging, doesnt work --- src/runtime.rs | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/runtime.rs b/src/runtime.rs index 25e61edc..4784e7dd 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -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> { - if config.is_debugging() || cfg.is_debugging() { - ImagLogger::init_logger(LogLevelFilter::Debug) + let lvl = if config.is_debugging() || cfg.is_debugging() { + LogLevelFilter::Debug } else if config.is_verbose() || cfg.is_debugging() { - ImagLogger::init_logger(LogLevelFilter::Info) + LogLevelFilter::Info } else { - ImagLogger::init_logger(LogLevelFilter::Error) - } + LogLevelFilter::Error + }; - } - - fn init_logger(lvlflt : LogLevelFilter) -> Result<(), SetLoggerError> { log::set_logger(|max_log_lvl| { - max_log_lvl.set(lvlflt); - debug!("Init logger with: {}", lvlflt); - Box::new(ImagLogger::new(lvlflt.to_log_level().unwrap())) + max_log_lvl.set(lvl); + debug!("Init logger with: {}", lvl); + Box::new(ImagLogger::new(lvl.to_log_level().unwrap())) }) }