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

Function TestLoggerLevel

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

Source from the content-addressed store, hash-verified

86}
87
88func TestLoggerLevel(t *testing.T) {
89 levels := []zapcore.Level{
90 DebugLevel,
91 InfoLevel,
92 WarnLevel,
93 ErrorLevel,
94 DPanicLevel,
95 PanicLevel,
96 FatalLevel,
97 }
98
99 for _, lvl := range levels {
100 lvl := lvl
101 t.Run(lvl.String(), func(t *testing.T) {
102 t.Parallel()
103
104 core, _ := observer.New(lvl)
105 log := New(core)
106 assert.Equal(t, lvl, log.Level())
107 })
108 }
109
110 t.Run("Nop", func(t *testing.T) {
111 assert.Equal(t, zapcore.InvalidLevel, NewNop().Level())
112 })
113}
114
115func TestLoggerInitialFields(t *testing.T) {
116 fieldOpts := opts(Fields(Int("foo", 42), String("bar", "baz")))

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
NewNopFunction · 0.85
NewFunction · 0.70
LevelMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected