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

Function Time

field.go:347–352  ·  view source on GitHub ↗

Time constructs a Field with the given key and value. The encoder controls how the time is serialized.

(key string, val time.Time)

Source from the content-addressed store, hash-verified

345// Time constructs a Field with the given key and value. The encoder
346// controls how the time is serialized.
347func Time(key string, val time.Time) Field {
348 if val.Before(_minTimeInt64) || val.After(_maxTimeInt64) {
349 return Field{Key: key, Type: zapcore.TimeFullType, Interface: val}
350 }
351 return Field{Key: key, Type: zapcore.TimeType, Integer: val.UnixNano(), Interface: val.Location()}
352}
353
354// Timep constructs a field that carries a *time.Time. The returned Field will safely
355// and explicitly represent `nil` when appropriate.

Callers 7

TestJSONEmptyConfigFunction · 0.92
TestEqualsFunction · 0.92
convertAttrToFieldFunction · 0.92
fakeFieldsFunction · 0.92
TestFieldConstructorsFunction · 0.85
BenchmarkTimeFieldFunction · 0.85
TimepFunction · 0.85

Calls 2

BeforeMethod · 0.80
AfterMethod · 0.80

Tested by 5

TestJSONEmptyConfigFunction · 0.74
TestEqualsFunction · 0.74
fakeFieldsFunction · 0.74
TestFieldConstructorsFunction · 0.68
BenchmarkTimeFieldFunction · 0.68