Add CLI option for log-level to test_harness

This commit is contained in:
Paul Hauner 2019-03-03 16:15:00 +11:00
parent 58002f68e1
commit 697d1ef626
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6

View File

@ -22,9 +22,20 @@ fn main() {
.help("YAML file test_case.") .help("YAML file test_case.")
.required(true), .required(true),
) )
.arg(
Arg::with_name("log")
.long("log-level")
.value_name("LOG_LEVEL")
.help("Logging level.")
.possible_values(&["error", "warn", "info", "debug", "trace"])
.default_value("debug")
.required(true),
)
.get_matches(); .get_matches();
Builder::from_env(Env::default().default_filter_or("debug")).init(); if let Some(log_level) = matches.value_of("log") {
Builder::from_env(Env::default().default_filter_or(log_level)).init();
}
if let Some(yaml_file) = matches.value_of("yaml") { if let Some(yaml_file) = matches.value_of("yaml") {
let docs = { let docs = {