(t *testing.T)
| 1248 | } |
| 1249 | |
| 1250 | func TestUpdateEmptyContext(t *testing.T) { |
| 1251 | var buf bytes.Buffer |
| 1252 | log := New(&buf) |
| 1253 | |
| 1254 | log.UpdateContext(func(c Context) Context { |
| 1255 | return c.Str("foo", "bar") |
| 1256 | }) |
| 1257 | log.Info().Msg("no panic") |
| 1258 | |
| 1259 | want := `{"level":"info","foo":"bar","message":"no panic"}` + "\n" |
| 1260 | |
| 1261 | if got := decodeIfBinaryToString(buf.Bytes()); got != want { |
| 1262 | t.Errorf("invalid log output:\ngot: %q\nwant: %q", got, want) |
| 1263 | } |
| 1264 | } |
| 1265 | |
| 1266 | func TestUpdateContextOnDisabledLogger(t *testing.T) { |
| 1267 | var buf bytes.Buffer |
nothing calls this directly
no test coverage detected
searching dependent graphs…