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

Function ExampleLogger_Level

binary_test.go:29–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27}
28
29func ExampleLogger_Level() {
30 dst := bytes.Buffer{}
31 log := New(&dst).Level(WarnLevel)
32
33 log.Info().Msg("filtered out message")
34 log.Error().Msg("kept message")
35
36 fmt.Println(decodeIfBinaryToString(dst.Bytes()))
37 // Output: {"level":"error","message":"kept message"}
38}
39
40func ExampleLogger_Sample() {
41 dst := bytes.Buffer{}

Callers

nothing calls this directly

Calls 8

NewFunction · 0.85
LevelMethod · 0.80
MsgMethod · 0.80
PrintlnMethod · 0.80
decodeIfBinaryToStringFunction · 0.70
InfoMethod · 0.65
ErrorMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected