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

Function ExampleContext_Dict

log_example_test.go:412–424  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

410}
411
412func ExampleContext_Dict() {
413 ctx := zerolog.New(os.Stdout).With().
414 Str("foo", "bar")
415
416 logger := ctx.Dict("dict", ctx.CreateDict().
417 Str("bar", "baz").
418 Int("n", 1),
419 ).Logger()
420
421 logger.Log().Msg("hello world")
422
423 // Output: {"foo":"bar","dict":{"bar":"baz","n":1},"message":"hello world"}
424}
425
426func ExampleContext_Array() {
427 ctx := zerolog.New(os.Stdout).With().

Callers

nothing calls this directly

Calls 9

NewFunction · 0.92
WithMethod · 0.80
LoggerMethod · 0.80
MsgMethod · 0.80
LogMethod · 0.65
StrMethod · 0.45
DictMethod · 0.45
IntMethod · 0.45
CreateDictMethod · 0.45

Tested by

no test coverage detected