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

Function NewNop

logger.go:87–94  ·  view source on GitHub ↗

NewNop returns a no-op Logger. It never writes out logs or internal errors, and it never runs user-defined hooks. Using WithOptions to replace the Core or error output of a no-op Logger can re-enable logging.

()

Source from the content-addressed store, hash-verified

85// Using WithOptions to replace the Core or error output of a no-op Logger can
86// re-enable logging.
87func NewNop() *Logger {
88 return &Logger{
89 core: zapcore.NewNopCore(),
90 errorOutput: zapcore.AddSync(io.Discard),
91 addStack: zapcore.FatalLevel + 1,
92 clock: zapcore.DefaultClock,
93 }
94}
95
96// NewProduction builds a sensible production Logger that writes InfoLevel and
97// above logs to standard error as JSON.

Callers 9

global.goFile · 0.85
TestGlobalsConcurrentUseFunction · 0.85
TestNewStdLogAtInvalidFunction · 0.85
TestSugaredLoggerLevelFunction · 0.85
TestLoggerLevelFunction · 0.85
TestNopLoggerFunction · 0.85
TestMustFunction · 0.85
NewFunction · 0.85

Calls 2

NewNopCoreFunction · 0.92
AddSyncFunction · 0.92

Tested by 7

TestGlobalsConcurrentUseFunction · 0.68
TestNewStdLogAtInvalidFunction · 0.68
TestSugaredLoggerLevelFunction · 0.68
TestLoggerLevelFunction · 0.68
TestNopLoggerFunction · 0.68
TestMustFunction · 0.68