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

Function ExampleContext_Dict

binary_test.go:417–431  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

415}
416
417func ExampleContext_Dict() {
418 dst := bytes.Buffer{}
419 ctx := New(&dst).With().
420 Str("foo", "bar")
421
422 logger := ctx.Dict("dict", ctx.CreateDict().
423 Str("bar", "baz").
424 Int("n", 1),
425 ).Logger()
426
427 logger.Log().Msg("hello world")
428
429 fmt.Println(decodeIfBinaryToString(dst.Bytes()))
430 // Output: {"foo":"bar","dict":{"bar":"baz","n":1},"message":"hello world"}
431}
432
433func ExampleContext_Array() {
434 dst := bytes.Buffer{}

Callers

nothing calls this directly

Calls 12

NewFunction · 0.85
WithMethod · 0.80
LoggerMethod · 0.80
MsgMethod · 0.80
PrintlnMethod · 0.80
decodeIfBinaryToStringFunction · 0.70
LogMethod · 0.65
StrMethod · 0.45
DictMethod · 0.45
IntMethod · 0.45
CreateDictMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…