From c81952002fd9d1080e31e0e8c16cf59a3f527c67 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Sat, 29 Jun 2024 17:35:45 +0200 Subject: [PATCH] fix(cli): loglevel values were not calculated correctly --- members/libpt-cli/src/args.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/members/libpt-cli/src/args.rs b/members/libpt-cli/src/args.rs index d947a3e..e4bc491 100644 --- a/members/libpt-cli/src/args.rs +++ b/members/libpt-cli/src/args.rs @@ -140,13 +140,21 @@ impl VerbosityLevel { /// get the [Level] for that VerbosityLevel #[inline] pub fn level(&self) -> Level { - match self.value() { + let v = self.value(); + match v { 0 => Level::ERROR, 1 => Level::WARN, 2 => Level::INFO, 3 => Level::DEBUG, 4 => Level::TRACE, - _ => Level::ERROR, + _ => { + if v > 4 { + Level::TRACE + } else { + /* v < 0 */ + Level::ERROR + } + } } }