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

Function TestJSONLevelKey

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

Source from the content-addressed store, hash-verified

235}
236
237func TestJSONLevelKey(t *testing.T) {
238 formatter := &JSONFormatter{
239 FieldMap: FieldMap{
240 FieldKeyLevel: "somelevel",
241 },
242 }
243
244 b, err := formatter.Format(WithField("level", "something"))
245 if err != nil {
246 t.Fatal("Unable to format entry: ", err)
247 }
248 s := string(b)
249 if !strings.Contains(s, "somelevel") {
250 t.Fatal("Expected JSON to format level key")
251 }
252}
253
254func TestJSONTimeKey(t *testing.T) {
255 formatter := &JSONFormatter{

Callers

nothing calls this directly

Calls 3

FormatMethod · 0.95
WithFieldFunction · 0.85
FatalMethod · 0.65

Tested by

no test coverage detected