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

Function ExampleNewConsoleWriter

console_test.go:63–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61}
62
63func ExampleNewConsoleWriter() {
64 out := zerolog.NewConsoleWriter()
65 out.NoColor = true // For testing purposes only
66 log := zerolog.New(out)
67
68 log.Debug().Str("foo", "bar").Msg("Hello World")
69 // Output: <nil> DBG Hello World foo=bar
70}
71
72func ExampleNewConsoleWriter_customFormatters() {
73 out := zerolog.NewConsoleWriter(

Callers

nothing calls this directly

Calls 5

NewConsoleWriterFunction · 0.92
NewFunction · 0.92
MsgMethod · 0.80
DebugMethod · 0.65
StrMethod · 0.45

Tested by

no test coverage detected