MCPcopy
hub / github.com/sirupsen/logrus / TestWithTimeShouldNotOverrideFields

Function TestWithTimeShouldNotOverrideFields

logrus_test.go:281–290  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

279}
280
281func TestWithTimeShouldNotOverrideFields(t *testing.T) {
282 now := time.Now().Add(24 * time.Hour)
283
284 LogAndAssertJSON(t, func(log *Logger) {
285 log.WithField("herp", "derp").WithTime(now).Info("blah")
286 }, func(fields Fields) {
287 assert.Equal(t, now.Format(time.RFC3339), fields["time"])
288 assert.Equal(t, "derp", fields["herp"])
289 })
290}
291
292func TestWithFieldShouldNotOverrideTime(t *testing.T) {
293 now := time.Now().Add(24 * time.Hour)

Callers

nothing calls this directly

Calls 6

LogAndAssertJSONFunction · 0.85
AddMethod · 0.80
InfoMethod · 0.65
WithFieldMethod · 0.65
FormatMethod · 0.65
WithTimeMethod · 0.45

Tested by

no test coverage detected