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

Function TestFieldClashWithLevel

json_formatter_test.go:92–109  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestFieldClashWithLevel(t *testing.T) {
93 formatter := &JSONFormatter{}
94
95 b, err := formatter.Format(WithField("level", "something"))
96 if err != nil {
97 t.Fatal("Unable to format entry: ", err)
98 }
99
100 entry := make(map[string]interface{})
101 err = json.Unmarshal(b, &entry)
102 if err != nil {
103 t.Fatal("Unable to unmarshal formatted entry: ", err)
104 }
105
106 if entry["fields.level"] != "something" {
107 t.Fatal("fields.level not set to original level field")
108 }
109}
110
111func TestFieldClashWithRemappedFields(t *testing.T) {
112 formatter := &JSONFormatter{

Callers

nothing calls this directly

Calls 3

FormatMethod · 0.95
WithFieldFunction · 0.85
FatalMethod · 0.65

Tested by

no test coverage detected