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

Function ExampleEvent_Array

log_example_test.go:243–260  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

241}
242
243func ExampleEvent_Array() {
244 log := zerolog.New(os.Stdout)
245
246 e := log.Log().
247 Str("foo", "bar")
248
249 e.Array("array", e.CreateArray().
250 Str("baz").
251 Int(1).
252 Dict(e.CreateDict().
253 Str("bar", "baz").
254 Int("n", 1),
255 ),
256 ).
257 Msg("hello world")
258
259 // Output: {"foo":"bar","array":["baz",1,{"bar":"baz","n":1}],"message":"hello world"}
260}
261
262func ExampleEvent_Array_object() {
263 log := zerolog.New(os.Stdout)

Callers

nothing calls this directly

Calls 9

NewFunction · 0.92
MsgMethod · 0.80
LogMethod · 0.65
StrMethod · 0.45
ArrayMethod · 0.45
DictMethod · 0.45
IntMethod · 0.45
CreateArrayMethod · 0.45
CreateDictMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…