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

Function ExampleEvent_Fields_map

log_example_test.go:380–394  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

378}
379
380func ExampleEvent_Fields_map() {
381 fields := map[string]interface{}{
382 "bar": "baz",
383 "n": 1,
384 }
385
386 log := zerolog.New(os.Stdout)
387
388 log.Log().
389 Str("foo", "bar").
390 Fields(fields).
391 Msg("hello world")
392
393 // Output: {"foo":"bar","bar":"baz","n":1,"message":"hello world"}
394}
395
396func ExampleEvent_Fields_slice() {
397 fields := []interface{}{

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
MsgMethod · 0.80
LogMethod · 0.65
FieldsMethod · 0.45
StrMethod · 0.45

Tested by

no test coverage detected