Merge pull request #1401 from matthiasbeyer/libimagrt/logging-level-fix

Fix log level setting in runtime
This commit is contained in:
Matthias Beyer 2018-04-15 09:35:10 +02:00 committed by GitHub
commit 877f0dfb6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -231,13 +231,13 @@ fn aggregate_global_loglevel(matches: &ArgMatches, config: Option<&Value>) -> Re
return Ok(Some(Level::Debug)) return Ok(Some(Level::Debug))
} }
if matches.is_present(Runtime::arg_verbosity_name()) {
return Ok(Some(Level::Info))
}
match matches.value_of(Runtime::arg_verbosity_name()) { match matches.value_of(Runtime::arg_verbosity_name()) {
Some(v) => match_log_level_str(v).map(Some), Some(v) => match_log_level_str(v).map(Some),
None => Ok(None), None => if matches.is_present(Runtime::arg_verbosity_name()) {
Ok(Some(Level::Info))
} else {
Ok(None)
},
} }
} }

View file

@ -185,6 +185,7 @@ impl<'a> Runtime<'a> {
.required(false) .required(false)
.takes_value(true) .takes_value(true)
.possible_values(&["trace", "debug", "info", "warn", "error"]) .possible_values(&["trace", "debug", "info", "warn", "error"])
.default_value("info")
.value_name("LOGLEVEL")) .value_name("LOGLEVEL"))
.arg(Arg::with_name(Runtime::arg_debugging_name()) .arg(Arg::with_name(Runtime::arg_debugging_name())