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

Method Time

event.go:765–771  ·  view source on GitHub ↗

Time adds the field key with t formatted as string using zerolog.TimeFieldFormat.

(key string, t time.Time)

Source from the content-addressed store, hash-verified

763
764// Time adds the field key with t formatted as string using zerolog.TimeFieldFormat.
765func (e *Event) Time(key string, t time.Time) *Event {
766 if e == nil {
767 return e
768 }
769 e.buf = enc.AppendTime(enc.AppendKey(e.buf, key), t, TimeFieldFormat)
770 return e
771}
772
773// Times adds the field key with t formatted as string using zerolog.TimeFieldFormat.
774func (e *Event) Times(key string, t []time.Time) *Event {

Callers 14

TestEvent_WithNilEventFunction · 0.95
MarshalZerologObjectMethod · 0.45
TestWithFunction · 0.45
TestFieldsFunction · 0.45
TestFieldsDisabledFunction · 0.45
TestArrayFunction · 0.45
MarshalZerologObjectMethod · 0.45
BenchmarkContextFieldsFunction · 0.45
BenchmarkLogFieldsFunction · 0.45
BenchmarkLogFieldTypeFunction · 0.45

Calls 2

AppendTimeMethod · 0.65
AppendKeyMethod · 0.65

Tested by 12

TestEvent_WithNilEventFunction · 0.76
MarshalZerologObjectMethod · 0.36
TestWithFunction · 0.36
TestFieldsFunction · 0.36
TestFieldsDisabledFunction · 0.36
TestArrayFunction · 0.36
MarshalZerologObjectMethod · 0.36
BenchmarkContextFieldsFunction · 0.36
BenchmarkLogFieldsFunction · 0.36
BenchmarkLogFieldTypeFunction · 0.36