Timestamp adds the current local time as UNIX timestamp to the *Event context with the "time" key. To customize the key name, change zerolog.TimestampFieldName. NOTE: It won't dedupe the "time" key if the *Event (or *Context) has one already.
()
| 754 | // NOTE: It won't dedupe the "time" key if the *Event (or *Context) has one |
| 755 | // already. |
| 756 | func (e *Event) Timestamp() *Event { |
| 757 | if e == nil { |
| 758 | return e |
| 759 | } |
| 760 | e.buf = enc.AppendTime(enc.AppendKey(e.buf, TimestampFieldName), TimestampFunc(), TimeFieldFormat) |
| 761 | return e |
| 762 | } |
| 763 | |
| 764 | // Time adds the field key with t formatted as string using zerolog.TimeFieldFormat. |
| 765 | func (e *Event) Time(key string, t time.Time) *Event { |