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

Function TestLogger_LogFn

example_function_test.go:10–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestLogger_LogFn(t *testing.T) {
11 log.SetFormatter(&log.JSONFormatter{})
12 log.SetLevel(log.WarnLevel)
13
14 notCalled := 0
15 log.InfoFn(func() []interface{} {
16 notCalled++
17 return []interface{}{
18 "Hello",
19 }
20 })
21 assert.Equal(t, 0, notCalled)
22
23 called := 0
24 log.ErrorFn(func() []interface{} {
25 called++
26 return []interface{}{
27 "Oopsi",
28 }
29 })
30 assert.Equal(t, 1, called)
31}

Callers

nothing calls this directly

Calls 4

SetFormatterMethod · 0.80
SetLevelMethod · 0.80
InfoFnMethod · 0.80
ErrorFnMethod · 0.80

Tested by

no test coverage detected