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

Function TestNewStdLogAtPanics

global_test.go:121–132  ·  global_test.go::TestNewStdLogAtPanics
(t *testing.T)

Source from the content-addressed store, hash-verified

119}
120
121func TestNewStdLogAtPanics(t *testing.T) {
122 // include DPanicLevel here and enable Development in options
123 levels := []zapcore.Level{DPanicLevel, PanicLevel}
124 for _, level := range levels {
125 withLogger(t, DebugLevel, []Option{AddCaller(), Development()}, func(l *Logger, logs *observer.ObservedLogs) {
126 std, err := NewStdLogAt(l, level)
127 require.NoError(t, err, "Unexpected error")
128 assert.Panics(t, func() { std.Print("redirected") }, "Expected log to panic.")
129 checkStdLogMessage(t, "redirected", logs)
130 })
131 }
132}
133
134func TestNewStdLogAtFatal(t *testing.T) {
135 withLogger(t, DebugLevel, []Option{AddCaller()}, func(l *Logger, logs *observer.ObservedLogs) {

Callers

nothing calls this directly

Calls 6

AddCallerFunction · 0.85
DevelopmentFunction · 0.85
NewStdLogAtFunction · 0.85
checkStdLogMessageFunction · 0.85
withLoggerFunction · 0.70
PrintMethod · 0.45

Tested by

no test coverage detected