MCPcopy
hub / github.com/uber-go/zap / AppendDuration

Method AppendDuration

zapcore/json_encoder.go:265–275  ·  view source on GitHub ↗
(val time.Duration)

Source from the content-addressed store, hash-verified

263}
264
265func (enc *jsonEncoder) AppendDuration(val time.Duration) {
266 cur := enc.buf.Len()
267 if e := enc.EncodeDuration; e != nil {
268 e(val, enc)
269 }
270 if cur == enc.buf.Len() {
271 // User-supplied EncodeDuration is a no-op. Fall back to nanoseconds to keep
272 // JSON valid.
273 enc.AppendInt64(int64(val))
274 }
275}
276
277func (enc *jsonEncoder) AppendInt64(val int64) {
278 enc.addElementSeparator()

Callers 1

AddDurationMethod · 0.95

Calls 2

AppendInt64Method · 0.95
LenMethod · 0.45

Tested by

no test coverage detected