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

Function TestLoggerReplaceCore

logger_test.go:762–772  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

760}
761
762func TestLoggerReplaceCore(t *testing.T) {
763 replace := WrapCore(func(zapcore.Core) zapcore.Core {
764 return zapcore.NewNopCore()
765 })
766 withLogger(t, DebugLevel, opts(replace), func(logger *Logger, logs *observer.ObservedLogs) {
767 logger.Debug("")
768 logger.Info("")
769 logger.Warn("")
770 assert.Equal(t, 0, logs.Len(), "Expected no-op core to write no logs.")
771 })
772}
773
774func TestLoggerIncreaseLevel(t *testing.T) {
775 withLogger(t, DebugLevel, opts(IncreaseLevel(WarnLevel)), func(logger *Logger, logs *observer.ObservedLogs) {

Callers

nothing calls this directly

Calls 8

NewNopCoreFunction · 0.92
WrapCoreFunction · 0.85
optsFunction · 0.85
withLoggerFunction · 0.70
DebugMethod · 0.45
InfoMethod · 0.45
WarnMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected