MCPcopy
hub / github.com/uber-go/zap / LevelOf

Function LevelOf

zapcore/level.go:98–110  ·  view source on GitHub ↗

LevelOf reports the minimum enabled log level for the given LevelEnabler 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 behavior of this function. func (c *core) Level() Level { return c.curre

(enab LevelEnabler)

Source from the content-addressed store, hash-verified

96// return zapcore.LevelOf(c.wrappedCore)
97// }
98func LevelOf(enab LevelEnabler) Level {
99 if lvler, ok := enab.(leveledEnabler); ok {
100 return lvler.Level()
101 }
102
103 for lvl := _minLevel; lvl <= _maxLevel; lvl++ {
104 if enab.Enabled(lvl) {
105 return lvl
106 }
107 }
108
109 return InvalidLevel
110}
111
112// String returns a lower-case ASCII representation of the log level.
113func (l Level) String() string {

Callers 15

LevelMethod · 0.92
LevelMethod · 0.92
TestObserverFunction · 0.92
LevelMethod · 0.92
TestLevelOfTeeFunction · 0.85
TestIncreaseLevelFunction · 0.85
TestLevelOfSamplerFunction · 0.85
TestHooksFunction · 0.85
LevelMethod · 0.85
TestIOCoreFunction · 0.85
LevelMethod · 0.85
LevelMethod · 0.85

Calls 2

LevelMethod · 0.65
EnabledMethod · 0.65

Tested by 7

TestObserverFunction · 0.74
TestLevelOfTeeFunction · 0.68
TestIncreaseLevelFunction · 0.68
TestLevelOfSamplerFunction · 0.68
TestHooksFunction · 0.68
TestIOCoreFunction · 0.68
TestLevelOfFunction · 0.68