From 3274b3bce780b5e66399c2186cbec66e5b1514d7 Mon Sep 17 00:00:00 2001 From: Kristofer Peterson Date: Thu, 11 May 2023 07:37:29 +0100 Subject: [PATCH] Addition of 'LvlDiscard Lvl = -1' at beginning of const block in commit e699254142 caused the iota assigned values of LvlCrit through LvlTrace to change from 0 to 5 to 1 to 6. (#815) This restores the original enumerated const values by moving LvlDiscard after all the iota assigned constants. Usage of auto-increment enumerations does not work the same way in golang as it does in C/C++ and its behaviour is detailed in the link below. https://go.dev/ref/spec#Iota --- log/logger.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/log/logger.go b/log/logger.go index c2678259bf7e..e5eb34cfb942 100644 --- a/log/logger.go +++ b/log/logger.go @@ -18,13 +18,13 @@ const skipLevel = 2 type Lvl int const ( - LvlDiscard Lvl = -1 - LvlCrit Lvl = iota + LvlCrit Lvl = iota LvlError LvlWarn LvlInfo LvlDebug LvlTrace + LvlDiscard Lvl = -1 ) // AlignedString returns a 5-character string containing the name of a Lvl.