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

Method Dur

event.go:785–791  ·  view source on GitHub ↗

Dur adds the field key with duration d stored as zerolog.DurationFieldUnit. If zerolog.DurationFieldInteger is true, durations are rendered as integer instead of float.

(key string, d time.Duration)

Source from the content-addressed store, hash-verified

783// If zerolog.DurationFieldInteger is true, durations are rendered as integer
784// instead of float.
785func (e *Event) Dur(key string, d time.Duration) *Event {
786 if e == nil {
787 return e
788 }
789 e.buf = enc.AppendDuration(enc.AppendKey(e.buf, key), d, DurationFieldUnit, DurationFieldFormat, DurationFieldInteger, FloatingPointPrecision)
790 return e
791}
792
793// Durs adds the field key with duration d stored as zerolog.DurationFieldUnit.
794// If zerolog.DurationFieldInteger is true, durations are rendered as integer

Callers 12

TestEvent_WithNilEventFunction · 0.95
ExampleEvent_DurFunction · 0.45
ExampleContext_DurFunction · 0.45
TestWithFunction · 0.45
TestFieldsFunction · 0.45
TestFieldsDisabledFunction · 0.45
TestArrayFunction · 0.45
ExampleEvent_DurFunction · 0.45
ExampleContext_DurFunction · 0.45
BenchmarkLogFieldTypeFunction · 0.45
appendSlogAttrFunction · 0.45

Calls 2

AppendDurationMethod · 0.65
AppendKeyMethod · 0.65

Tested by 11

TestEvent_WithNilEventFunction · 0.76
ExampleEvent_DurFunction · 0.36
ExampleContext_DurFunction · 0.36
TestWithFunction · 0.36
TestFieldsFunction · 0.36
TestFieldsDisabledFunction · 0.36
TestArrayFunction · 0.36
ExampleEvent_DurFunction · 0.36
ExampleContext_DurFunction · 0.36
BenchmarkLogFieldTypeFunction · 0.36