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

Function TestJSONDisableTimestamp

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

Source from the content-addressed store, hash-verified

318}
319
320func TestJSONDisableTimestamp(t *testing.T) {
321 formatter := &JSONFormatter{
322 DisableTimestamp: true,
323 }
324
325 b, err := formatter.Format(WithField("level", "something"))
326 if err != nil {
327 t.Fatal("Unable to format entry: ", err)
328 }
329 s := string(b)
330 if strings.Contains(s, FieldKeyTime) {
331 t.Error("Did not prevent timestamp", s)
332 }
333}
334
335func TestJSONEnableTimestamp(t *testing.T) {
336 formatter := &JSONFormatter{}

Callers

nothing calls this directly

Calls 4

FormatMethod · 0.95
WithFieldFunction · 0.85
FatalMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected