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

Function ExampleContext_Dur

log_example_test.go:529–540  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

527}
528
529func ExampleContext_Dur() {
530 d := 10 * time.Second
531
532 log := zerolog.New(os.Stdout).With().
533 Str("foo", "bar").
534 Dur("dur", d).
535 Logger()
536
537 log.Log().Msg("hello world")
538
539 // Output: {"foo":"bar","dur":10000,"message":"hello world"}
540}
541
542func ExampleContext_Durs() {
543 d := []time.Duration{

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected