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

Function ExampleContext_Fields_slice

log_example_test.go:629–643  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

627}
628
629func ExampleContext_Fields_slice() {
630 fields := []interface{}{
631 "bar", "baz",
632 "n", 1,
633 }
634
635 log := zerolog.New(os.Stdout).With().
636 Str("foo", "bar").
637 Fields(fields).
638 Logger()
639
640 log.Log().Msg("hello world")
641
642 // Output: {"foo":"bar","bar":"baz","n":1,"message":"hello world"}
643}
644
645func ExampleContext_Times() {
646 t1 := time.Time{}

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…