diff --git a/lib/core/core/cli/mod.rs b/lib/core/core/cli/mod.rs index 4c9bdddb2e46f1c21b6bcf6d36014166087dcdce..4c89621c97e59e65b2686eb73aaf04b150044a67 100644 --- a/lib/core/core/cli/mod.rs +++ b/lib/core/core/cli/mod.rs @@ -41,7 +41,7 @@ pub struct DursOpt { profile_name: Option<String>, #[structopt(short = "l", long = "logs", raw(next_line_help = "true"))] /// Set log level. (Defaults to INFO). - /// Available levels: [OFF, ERROR, WARN, INFO, DEBUG, TRACE] + /// Available levels: [ERROR, WARN, INFO, DEBUG, TRACE] logs_level: Option<Level>, #[structopt(subcommand)] /// CoreSubCommand diff --git a/lib/core/core/lib.rs b/lib/core/core/lib.rs index 1de04dc499d81257af031881d3b573d2bde5a897..aaa2a6d2eae82020c1a4b5ca2d6e4b202f2516aa 100644 --- a/lib/core/core/lib.rs +++ b/lib/core/core/lib.rs @@ -711,13 +711,13 @@ pub fn init_logger(profile: &str, soft_name: &'static str, cli_args: &ArgMatches log_file_path.push(format!("{}.log", soft_name)); // Get log level - let log_level = match cli_args.value_of("logs_level").unwrap_or("i") { - "e" | "error" => Level::Error, - "w" | "warn" => Level::Warn, - "i" | "info" => Level::Info, - "d" | "debug" => Level::Debug, - "t" | "trace" => Level::Trace, - _ => panic!("Fatal error : unknow log level !"), + let log_level = match cli_args.value_of("logs_level").unwrap_or("INFO") { + "ERROR" => Level::Error, + "WARN" => Level::Warn, + "INFO" => Level::Info, + "DEBUG" => Level::Debug, + "TRACE" => Level::Trace, + _ => unreachable!("Structopt guarantees us that the string match necessarily with one of the variants of the enum Level"), }; // Config logger