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

Function ExampleContext_Dur

binary_test.go:533–546  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

531}
532
533func ExampleContext_Dur() {
534 d := time.Duration(10 * time.Second)
535
536 dst := bytes.Buffer{}
537 log := New(&dst).With().
538 Str("foo", "bar").
539 Dur("dur", d).
540 Logger()
541
542 log.Log().Msg("hello world")
543
544 fmt.Println(decodeIfBinaryToString(dst.Bytes()))
545 // Output: {"foo":"bar","dur":10000,"message":"hello world"}
546}
547
548func ExampleContext_Durs() {
549 d := []time.Duration{

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
DurMethod · 0.45
StrMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected