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

Function TestOutputWithContext

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

Source from the content-addressed store, hash-verified

1144}
1145
1146func TestOutputWithContext(t *testing.T) {
1147 ignoredOut := &bytes.Buffer{}
1148 out := &bytes.Buffer{}
1149 log := New(ignoredOut).With().Str("foo", "bar").Logger().Output(out)
1150 log.Log().Msg("hello world")
1151
1152 if got, want := decodeIfBinaryToString(out.Bytes()), `{"foo":"bar","message":"hello world"}`+"\n"; got != want {
1153 t.Errorf("invalid log output:\ngot: %v\nwant: %v", got, want)
1154 }
1155}
1156
1157func TestCallerMarshalFunc(t *testing.T) {
1158 out := &bytes.Buffer{}

Callers

nothing calls this directly

Calls 9

NewFunction · 0.85
OutputMethod · 0.80
LoggerMethod · 0.80
WithMethod · 0.80
MsgMethod · 0.80
decodeIfBinaryToStringFunction · 0.70
LogMethod · 0.65
StrMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…