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

Function ExampleEvent_Dur

binary_test.go:348–361  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

346}
347
348func ExampleEvent_Dur() {
349 d := time.Duration(10 * time.Second)
350
351 dst := bytes.Buffer{}
352 log := New(&dst)
353
354 log.Log().
355 Str("foo", "bar").
356 Dur("dur", d).
357 Msg("hello world")
358
359 fmt.Println(decodeIfBinaryToString(dst.Bytes()))
360 // Output: {"foo":"bar","dur":10000,"message":"hello world"}
361}
362
363func ExampleEvent_Durs() {
364 d := []time.Duration{

Callers

nothing calls this directly

Calls 8

NewFunction · 0.85
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