MCPcopy
hub / github.com/rs/zerolog / TestUpdateContextOnZeroValueLogger

Function TestUpdateContextOnZeroValueLogger

log_test.go:1299–1313  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1297}
1298
1299func TestUpdateContextOnZeroValueLogger(t *testing.T) {
1300 // A zero-value Logger has a nil writer and should be treated as
1301 // disabled by UpdateContext. See issue #643.
1302 var log Logger
1303
1304 called := false
1305 log.UpdateContext(func(c Context) Context {
1306 called = true
1307 return c.Str("foo", "bar")
1308 })
1309
1310 if called {
1311 t.Error("UpdateContext should not call update func on a zero-value logger")
1312 }
1313}
1314
1315func TestLevel_String(t *testing.T) {
1316 tests := []struct {

Callers

nothing calls this directly

Calls 3

UpdateContextMethod · 0.95
StrMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected