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

Function ExampleContext_Durs

log_example_test.go:542–556  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

540}
541
542func ExampleContext_Durs() {
543 d := []time.Duration{
544 10 * time.Second,
545 20 * time.Second,
546 }
547
548 log := zerolog.New(os.Stdout).With().
549 Str("foo", "bar").
550 Durs("durs", d).
551 Logger()
552
553 log.Log().Msg("hello world")
554
555 // Output: {"foo":"bar","durs":[10000,20000],"message":"hello world"}
556}
557
558func ExampleContext_IPAddr() {
559 hostIP := net.IP{192, 168, 0, 100}

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected