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

Function ExampleLogger_Sample

binary_test.go:40–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38}
39
40func ExampleLogger_Sample() {
41 dst := bytes.Buffer{}
42 log := New(&dst).Sample(&BasicSampler{N: 2})
43
44 log.Info().Msg("message 1")
45 log.Info().Msg("message 2")
46 log.Info().Msg("message 3")
47 log.Info().Msg("message 4")
48
49 fmt.Println(decodeIfBinaryToString(dst.Bytes()))
50 // Output: {"level":"info","message":"message 1"}
51 // {"level":"info","message":"message 3"}
52}
53
54type LevelNameHook1 struct{}
55

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected