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

Function TestLoggerInitialFields

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

Source from the content-addressed store, hash-verified

113}
114
115func TestLoggerInitialFields(t *testing.T) {
116 fieldOpts := opts(Fields(Int("foo", 42), String("bar", "baz")))
117 withLogger(t, DebugLevel, fieldOpts, func(logger *Logger, logs *observer.ObservedLogs) {
118 logger.Info("")
119 assert.Equal(
120 t,
121 observer.LoggedEntry{Context: []Field{Int("foo", 42), String("bar", "baz")}},
122 logs.AllUntimed()[0],
123 "Unexpected output with initial fields set.",
124 )
125 })
126}
127
128func TestLoggerWith(t *testing.T) {
129 tests := []struct {

Callers

nothing calls this directly

Calls 7

optsFunction · 0.85
FieldsFunction · 0.85
IntFunction · 0.85
StringFunction · 0.85
AllUntimedMethod · 0.80
withLoggerFunction · 0.70
InfoMethod · 0.45

Tested by

no test coverage detected