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

Function ExampleContext_Durs

binary_test.go:548–564  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

546}
547
548func ExampleContext_Durs() {
549 d := []time.Duration{
550 time.Duration(10 * time.Second),
551 time.Duration(20 * time.Second),
552 }
553
554 dst := bytes.Buffer{}
555 log := New(&dst).With().
556 Str("foo", "bar").
557 Durs("durs", d).
558 Logger()
559
560 log.Log().Msg("hello world")
561
562 fmt.Println(decodeIfBinaryToString(dst.Bytes()))
563 // Output: {"foo":"bar","durs":[10000,20000],"message":"hello world"}
564}
565
566func ExampleContext_Fields_map() {
567 fields := map[string]interface{}{

Callers

nothing calls this directly

Calls 10

NewFunction · 0.85
LoggerMethod · 0.80
WithMethod · 0.80
MsgMethod · 0.80
PrintlnMethod · 0.80
decodeIfBinaryToStringFunction · 0.70
LogMethod · 0.65
DursMethod · 0.45
StrMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected