From 02ddbeff5eaa98ac95aef19b519e6dfec0e08a97 Mon Sep 17 00:00:00 2001 From: Josh McKinney Date: Wed, 25 Sep 2024 23:54:32 -0700 Subject: [PATCH] refactor: Shift numeric level to be 0 based --- src/lib.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 363cac3..48a9dc1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -133,23 +133,23 @@ impl Verbosity { fn level_value(level: Option) -> i8 { match level { - None => -1, - Some(Level::Error) => 0, - Some(Level::Warn) => 1, - Some(Level::Info) => 2, - Some(Level::Debug) => 3, - Some(Level::Trace) => 4, + None => 0, + Some(Level::Error) => 1, + Some(Level::Warn) => 2, + Some(Level::Info) => 3, + Some(Level::Debug) => 4, + Some(Level::Trace) => 5, } } fn level_enum(verbosity: i8) -> Option { match verbosity { - i8::MIN..=-1 => None, - 0 => Some(Level::Error), - 1 => Some(Level::Warn), - 2 => Some(Level::Info), - 3 => Some(Level::Debug), - 4..=i8::MAX => Some(Level::Trace), + i8::MIN..=0 => None, + 1 => Some(Level::Error), + 2 => Some(Level::Warn), + 3 => Some(Level::Info), + 4 => Some(Level::Debug), + 5..=i8::MAX => Some(Level::Trace), } }