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

Function ExampleLogger_Write

binary_test.go:177–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

175}
176
177func ExampleLogger_Write() {
178 dst := bytes.Buffer{}
179 log := New(&dst).With().
180 Str("foo", "bar").
181 Logger()
182
183 stdlog.SetFlags(0)
184 stdlog.SetOutput(log)
185
186 stdlog.Print("hello world")
187
188 fmt.Println(decodeIfBinaryToString(dst.Bytes()))
189 // Output: {"foo":"bar","message":"hello world"}
190}
191
192func ExampleLogger_Log() {
193 dst := bytes.Buffer{}

Callers

nothing calls this directly

Calls 8

NewFunction · 0.85
LoggerMethod · 0.80
WithMethod · 0.80
PrintMethod · 0.80
PrintlnMethod · 0.80
decodeIfBinaryToStringFunction · 0.70
StrMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected