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

Function IncreaseLevel

options.go:124–137  ·  view source on GitHub ↗

IncreaseLevel increase the level of the logger. It has no effect if the passed in level tries to decrease the level of the logger.

(lvl zapcore.LevelEnabler)

Source from the content-addressed store, hash-verified

122// IncreaseLevel increase the level of the logger. It has no effect if
123// the passed in level tries to decrease the level of the logger.
124func IncreaseLevel(lvl zapcore.LevelEnabler) Option {
125 return optionFunc(func(log *Logger) {
126 core, err := zapcore.NewIncreaseLevelCore(log.core, lvl)
127 if err != nil {
128 _, _ = fmt.Fprintf(
129 log.errorOutput,
130 "failed to IncreaseLevel: %v\n",
131 err,
132 )
133 } else {
134 log.core = core
135 }
136 })
137}
138
139// WithPanicHook sets a CheckWriteHook to run on Panic/DPanic logs.
140// Zap will call this hook after writing a log statement with a Panic/DPanic level.

Callers 6

Example_slogFunction · 0.92
TestIncreaseLevelFunction · 0.85
TestLoggerIncreaseLevelFunction · 0.85

Calls 2

NewIncreaseLevelCoreFunction · 0.92
optionFuncFuncType · 0.70

Tested by 6

Example_slogFunction · 0.74
TestIncreaseLevelFunction · 0.68
TestLoggerIncreaseLevelFunction · 0.68