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:
Homu 2016-01-02 23:30:29 +09:00
commit 522f1dccff
2 changed files with 6 additions and 4 deletions

View file

@ -29,8 +29,10 @@ fn main() {
let yaml = load_yaml!("../etc/cli.yml");
let app = App::from_yaml(yaml);
let config = CliConfig::new(app);
ImagLogger::init(&config);
let configuration = Configuration::new(&config);
ImagLogger::init(&configuration, &config);
debug!("Logger created!");
debug!("CliConfig : {:?}", &config);

View file

@ -20,10 +20,10 @@ impl ImagLogger {
}
}
pub fn init(cfg: &Cfg, config: &CliConfig) -> Result<(), SetLoggerError> {
let lvl = if config.is_debugging() || cfg.is_debugging() {
pub fn init(config: &CliConfig) -> Result<(), SetLoggerError> {
let lvl = if config.is_debugging() {
LogLevelFilter::Debug
} else if config.is_verbose() || cfg.is_debugging() {
} else if config.is_verbose() {
LogLevelFilter::Info
} else {
LogLevelFilter::Error