Auto merge of #42 - matthiasbeyer:logger-depends-on-cli-only, r=matthiasbeyer
ImagLogger can be configured through the CLI only now The logger instance cannot be configured through the configuration file, as this is kinda bulky to use and we can log to debug much earlier now.
This commit is contained in:
commit
522f1dccff
2 changed files with 6 additions and 4 deletions
|
@ -29,8 +29,10 @@ fn main() {
|
||||||
let yaml = load_yaml!("../etc/cli.yml");
|
let yaml = load_yaml!("../etc/cli.yml");
|
||||||
let app = App::from_yaml(yaml);
|
let app = App::from_yaml(yaml);
|
||||||
let config = CliConfig::new(app);
|
let config = CliConfig::new(app);
|
||||||
|
|
||||||
|
ImagLogger::init(&config);
|
||||||
|
|
||||||
let configuration = Configuration::new(&config);
|
let configuration = Configuration::new(&config);
|
||||||
ImagLogger::init(&configuration, &config);
|
|
||||||
|
|
||||||
debug!("Logger created!");
|
debug!("Logger created!");
|
||||||
debug!("CliConfig : {:?}", &config);
|
debug!("CliConfig : {:?}", &config);
|
||||||
|
|
|
@ -20,10 +20,10 @@ impl ImagLogger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init(cfg: &Cfg, config: &CliConfig) -> Result<(), SetLoggerError> {
|
pub fn init(config: &CliConfig) -> Result<(), SetLoggerError> {
|
||||||
let lvl = if config.is_debugging() || cfg.is_debugging() {
|
let lvl = if config.is_debugging() {
|
||||||
LogLevelFilter::Debug
|
LogLevelFilter::Debug
|
||||||
} else if config.is_verbose() || cfg.is_debugging() {
|
} else if config.is_verbose() {
|
||||||
LogLevelFilter::Info
|
LogLevelFilter::Info
|
||||||
} else {
|
} else {
|
||||||
LogLevelFilter::Error
|
LogLevelFilter::Error
|
||||||
|
|
Loading…
Reference in a new issue