From f7b09562e446e8601a92f908072100e1445cd6b1 Mon Sep 17 00:00:00 2001 From: Hubert Grochowski Date: Tue, 18 Jun 2024 10:21:54 +0200 Subject: [PATCH] log: start levels from 1 That would eliminate the zero value issue with flags. Fixes #832 --- log/level.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/log/level.go b/log/level.go index 9c555673..03f0219b 100644 --- a/log/level.go +++ b/log/level.go @@ -9,11 +9,11 @@ package log type Level int32 const ( - ErrorLevel Level = iota + ErrorLevel Level = 1 + iota InfoLevel DebugLevel ) func (l Level) String() string { - return [3]string{"error", "info", "debug"}[l] + return [3]string{"error", "info", "debug"}[l-1] }