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

Function TestLoggerWithFatalHook

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

Source from the content-addressed store, hash-verified

1013}
1014
1015func TestLoggerWithFatalHook(t *testing.T) {
1016 var h customWriteHook
1017 withLogger(t, InfoLevel, opts(WithFatalHook(&h)), func(logger *Logger, logs *observer.ObservedLogs) {
1018 logger.Fatal("great sadness")
1019 assert.True(t, h.called)
1020 assert.Equal(t, 1, logs.FilterLevelExact(FatalLevel).Len())
1021 })
1022}
1023
1024func TestNopLogger(t *testing.T) {
1025 logger := NewNop()

Callers

nothing calls this directly

Calls 6

optsFunction · 0.85
WithFatalHookFunction · 0.85
FilterLevelExactMethod · 0.80
withLoggerFunction · 0.70
FatalMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected