Skip to content

Commit

Permalink
Rename UnknownLevel to InvalidLevel
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinav committed Aug 15, 2022
1 parent d5d409e commit 1a7cb65
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions zapcore/level.go
Expand Up @@ -54,10 +54,10 @@ const (
_minLevel = DebugLevel
_maxLevel = FatalLevel

// UnknownLevel is an invalid value for Level.
// InvalidLevel is an invalid value for Level.
//
// Core implementations may panic if they see messages of this level.
UnknownLevel = _maxLevel + 1
InvalidLevel = _maxLevel + 1
)

// ParseLevel parses a level based on the lower-case or all-caps ASCII
Expand All @@ -79,7 +79,7 @@ type leveledEnabler interface {
}

// LevelOf reports the minimum enabled log level for the given LevelEnabler
// from Zap's supported log levels, or [UnknownLevel] if none of them are
// from Zap's supported log levels, or [InvalidLevel] if none of them are
// enabled.
//
// A LevelEnabler may implement a 'Level() Level' method to override the
Expand All @@ -106,7 +106,7 @@ func LevelOf(enab LevelEnabler) Level {
}
}

return UnknownLevel
return InvalidLevel
}

// String returns a lower-case ASCII representation of the log level.
Expand Down
4 changes: 2 additions & 2 deletions zapcore/level_test.go
Expand Up @@ -39,7 +39,7 @@ func TestLevelString(t *testing.T) {
PanicLevel: "panic",
FatalLevel: "fatal",
Level(-42): "Level(-42)",
UnknownLevel: "Level(6)", // UnknownLevel does not have a name
InvalidLevel: "Level(6)", // InvalidLevel does not have a name
}

for lvl, stringLevel := range tests {
Expand Down Expand Up @@ -234,7 +234,7 @@ func TestLevelOf(t *testing.T) {
{
desc: "noop",
give: NewNopCore(), // always disabled
want: UnknownLevel,
want: InvalidLevel,
},
}

Expand Down
2 changes: 1 addition & 1 deletion zapcore/tee_test.go
Expand Up @@ -58,7 +58,7 @@ func TestLevelOfTee(t *testing.T) {
give []Core
want Level
}{
{desc: "empty", want: UnknownLevel},
{desc: "empty", want: InvalidLevel},
{
desc: "debug",
give: []Core{debugLogger},
Expand Down

0 comments on commit 1a7cb65

Please sign in to comment.