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

Function TestWithTimeShouldOverrideTime

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

Source from the content-addressed store, hash-verified

269}
270
271func TestWithTimeShouldOverrideTime(t *testing.T) {
272 now := time.Now().Add(24 * time.Hour)
273
274 LogAndAssertJSON(t, func(log *Logger) {
275 log.WithTime(now).Info("foobar")
276 }, func(fields Fields) {
277 assert.Equal(t, fields["time"], now.Format(time.RFC3339))
278 })
279}
280
281func TestWithTimeShouldNotOverrideFields(t *testing.T) {
282 now := time.Now().Add(24 * time.Hour)

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected