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

Function ExampleLogger_With

binary_test.go:16–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14)
15
16func ExampleLogger_With() {
17 dst := bytes.Buffer{}
18 log := New(&dst).
19 With().
20 Str("foo", "bar").
21 Logger()
22
23 log.Info().Msg("hello world")
24 fmt.Println(decodeIfBinaryToString(dst.Bytes()))
25
26 // Output: {"level":"info","foo":"bar","message":"hello world"}
27}
28
29func ExampleLogger_Level() {
30 dst := bytes.Buffer{}

Callers

nothing calls this directly

Calls 9

NewFunction · 0.85
LoggerMethod · 0.80
WithMethod · 0.80
MsgMethod · 0.80
PrintlnMethod · 0.80
decodeIfBinaryToStringFunction · 0.70
InfoMethod · 0.65
StrMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected