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

Function ExampleContext_Times

log_example_test.go:645–658  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

643}
644
645func ExampleContext_Times() {
646 t1 := time.Time{}
647 t2 := t1.Add(time.Second * 10)
648 t := []time.Time{t1, t2}
649
650 log := zerolog.New(os.Stdout).With().
651 Str("foo", "bar").
652 Times("times", t).
653 Logger()
654
655 log.Log().Msg("hello world")
656
657 // Output: {"foo":"bar","times":["0001-01-01T00:00:00Z","0001-01-01T00:00:10Z"],"message":"hello world"}
658}
659
660func ExampleEvent_Stringers() {
661 log := zerolog.New(os.Stdout)

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…