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

Function TestUserSuppliedLevelFieldHasPrefix

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

Source from the content-addressed store, hash-verified

246}
247
248func TestUserSuppliedLevelFieldHasPrefix(t *testing.T) {
249 LogAndAssertJSON(t, func(log *Logger) {
250 log.WithField("level", 1).Info("test")
251 }, func(fields Fields) {
252 assert.Equal(t, "info", fields["level"])
253 assert.Equal(t, 1.0, fields["fields.level"]) // JSON has floats only
254 })
255}
256
257func TestDefaultFieldsAreNotPrefixed(t *testing.T) {
258 LogAndAssertText(t, func(log *Logger) {

Callers

nothing calls this directly

Calls 3

LogAndAssertJSONFunction · 0.85
InfoMethod · 0.65
WithFieldMethod · 0.65

Tested by

no test coverage detected