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

Function TestDefaultFieldsAreNotPrefixed

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

Source from the content-addressed store, hash-verified

255}
256
257func TestDefaultFieldsAreNotPrefixed(t *testing.T) {
258 LogAndAssertText(t, func(log *Logger) {
259 ll := log.WithField("herp", "derp")
260 ll.Info("hello")
261 ll.Info("bye")
262 }, func(fields map[string]string) {
263 for _, fieldName := range []string{"fields.level", "fields.time", "fields.msg"} {
264 if _, ok := fields[fieldName]; ok {
265 t.Fatalf("should not have prefixed %q: %v", fieldName, fields)
266 }
267 }
268 })
269}
270
271func TestWithTimeShouldOverrideTime(t *testing.T) {
272 now := time.Now().Add(24 * time.Hour)

Callers

nothing calls this directly

Calls 4

LogAndAssertTextFunction · 0.85
WithFieldMethod · 0.65
InfoMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected