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

Function ExampleLogger_With

log_example_test.go:23–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21}
22
23func ExampleLogger_With() {
24 log := zerolog.New(os.Stdout).
25 With().
26 Str("foo", "bar").
27 Logger()
28
29 log.Info().Msg("hello world")
30
31 // Output: {"level":"info","foo":"bar","message":"hello world"}
32}
33
34func ExampleLogger_Level() {
35 log := zerolog.New(os.Stdout).Level(zerolog.WarnLevel)

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
LoggerMethod · 0.80
WithMethod · 0.80
MsgMethod · 0.80
InfoMethod · 0.65
StrMethod · 0.45

Tested by

no test coverage detected