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

Function ExampleContext_Array

log_example_test.go:426–438  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

424}
425
426func ExampleContext_Array() {
427 ctx := zerolog.New(os.Stdout).With().
428 Str("foo", "bar")
429
430 logger := ctx.Array("array", ctx.CreateArray().
431 Str("baz").
432 Int(1),
433 ).Logger()
434
435 logger.Log().Msg("hello world")
436
437 // Output: {"foo":"bar","array":["baz",1],"message":"hello world"}
438}
439
440func ExampleContext_Array_object() {
441 // Users implements zerolog.LogArrayMarshaler

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
ArrayMethod · 0.45
IntMethod · 0.45
CreateArrayMethod · 0.45

Tested by

no test coverage detected