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

Function TestJSONMessageKey

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

Source from the content-addressed store, hash-verified

218}
219
220func TestJSONMessageKey(t *testing.T) {
221 formatter := &JSONFormatter{
222 FieldMap: FieldMap{
223 FieldKeyMsg: "message",
224 },
225 }
226
227 b, err := formatter.Format(&Entry{Message: "oh hai"})
228 if err != nil {
229 t.Fatal("Unable to format entry: ", err)
230 }
231 s := string(b)
232 if !(strings.Contains(s, "message") && strings.Contains(s, "oh hai")) {
233 t.Fatal("Expected JSON to format message key")
234 }
235}
236
237func TestJSONLevelKey(t *testing.T) {
238 formatter := &JSONFormatter{

Callers

nothing calls this directly

Calls 2

FormatMethod · 0.95
FatalMethod · 0.65

Tested by

no test coverage detected