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

Function New

zaptest/observer/observer.go:155–161  ·  view source on GitHub ↗

New creates a new Core that buffers logs in memory (without any encoding). It's particularly useful in tests.

(enab zapcore.LevelEnabler)

Source from the content-addressed store, hash-verified

153// New creates a new Core that buffers logs in memory (without any encoding).
154// It's particularly useful in tests.
155func New(enab zapcore.LevelEnabler) (zapcore.Core, *ObservedLogs) {
156 ol := &ObservedLogs{}
157 return &contextObserver{
158 LevelEnabler: enab,
159 logs: ol,
160 }, ol
161}
162
163type contextObserver struct {
164 zapcore.LevelEnabler

Callers 15

withLoggerFunction · 0.92
TestSugaredLoggerLevelFunction · 0.92
TestLoggerLevelFunction · 0.92
TestLoggerFatalOnNoopFunction · 0.92
TestWriterFunction · 0.92
TestWrite_SyncFunction · 0.92
withTeeFunction · 0.92
TestTeeUnusualInputFunction · 0.92
TestLevelOfTeeFunction · 0.92
TestTeeEnabledFunction · 0.92
TestTeeSyncFunction · 0.92
TestIncreaseLevelFunction · 0.92

Calls

no outgoing calls

Tested by 15

withLoggerFunction · 0.74
TestSugaredLoggerLevelFunction · 0.74
TestLoggerLevelFunction · 0.74
TestLoggerFatalOnNoopFunction · 0.74
TestWriterFunction · 0.74
TestWrite_SyncFunction · 0.74
withTeeFunction · 0.74
TestTeeUnusualInputFunction · 0.74
TestLevelOfTeeFunction · 0.74
TestTeeEnabledFunction · 0.74
TestTeeSyncFunction · 0.74
TestIncreaseLevelFunction · 0.74