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

Function ExampleLogger_WithLevel

binary_test.go:166–175  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

164}
165
166func ExampleLogger_WithLevel() {
167 dst := bytes.Buffer{}
168 log := New(&dst)
169
170 log.WithLevel(InfoLevel).
171 Msg("hello world")
172
173 fmt.Println(decodeIfBinaryToString(dst.Bytes()))
174 // Output: {"level":"info","message":"hello world"}
175}
176
177func ExampleLogger_Write() {
178 dst := bytes.Buffer{}

Callers

nothing calls this directly

Calls 6

NewFunction · 0.85
MsgMethod · 0.80
WithLevelMethod · 0.80
PrintlnMethod · 0.80
decodeIfBinaryToStringFunction · 0.70
BytesMethod · 0.45

Tested by

no test coverage detected