Skip to content

Commit

Permalink
Addition of 'LvlDiscard Lvl = -1' at beginning of const block in commit
Browse files Browse the repository at this point in the history
e699254 caused the iota assigned values of LvlCrit through LvlTrace to change from 0 to 5 to 1 to 6. (ethereum#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
  • Loading branch information
svenski123 authored May 11, 2023
1 parent b6de7aa commit 3274b3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3274b3b

Please sign in to comment.