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

Function TestStackedWiths

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

Source from the content-addressed store, hash-verified

157}
158
159func TestStackedWiths(t *testing.T) {
160 out := &bytes.Buffer{}
161 ctx := New(out).With().
162 Bool("bool", true)
163 ctx = ctx.Logger().With().
164 Int("int", 1)
165 log := ctx.Logger()
166 log.Log().Msg("")
167 if got, want := decodeIfBinaryToString(out.Bytes()),
168 `{"bool":true,"int":1}`+"\n"; got != want {
169 t.Errorf("invalid log output:\ngot: %v\nwant: %v", got, want)
170 }
171}
172
173func TestWithPlurals(t *testing.T) {
174 out := &bytes.Buffer{}

Callers

nothing calls this directly

Calls 9

NewFunction · 0.85
WithMethod · 0.80
LoggerMethod · 0.80
MsgMethod · 0.80
decodeIfBinaryToStringFunction · 0.70
LogMethod · 0.65
BoolMethod · 0.45
IntMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected