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

Function TestWithFieldShouldNotOverrideTime

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

Source from the content-addressed store, hash-verified

290}
291
292func TestWithFieldShouldNotOverrideTime(t *testing.T) {
293 now := time.Now().Add(24 * time.Hour)
294
295 LogAndAssertJSON(t, func(log *Logger) {
296 log.WithTime(now).WithField("herp", "derp").Info("blah")
297 }, func(fields Fields) {
298 assert.Equal(t, now.Format(time.RFC3339), fields["time"])
299 assert.Equal(t, "derp", fields["herp"])
300 })
301}
302
303func TestTimeOverrideMultipleLogs(t *testing.T) {
304 var buffer bytes.Buffer

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