forked from smartcontractkit/chainlink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
null_logger_test.go
56 lines (48 loc) · 960 Bytes
/
null_logger_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package logger_test
import (
"testing"
"github.com/stretchr/testify/assert"
"go.uber.org/zap/zapcore"
"github.com/smartcontractkit/chainlink/v2/core/logger"
)
func TestNullLogger(t *testing.T) {
t.Parallel()
t.Run("names", func(t *testing.T) {
t.Parallel()
l := logger.NullLogger
assert.Equal(t, l, l.Named("foo"))
assert.Equal(t, l, l.With("foo"))
assert.Equal(t, l, l.Helper(123))
})
t.Run("no-op", func(t *testing.T) {
t.Parallel()
l := logger.NullLogger
l.SetLogLevel(zapcore.DebugLevel)
l.Trace()
l.Debug()
l.Info()
l.Warn()
l.Error()
l.Critical()
l.Panic()
l.Fatal()
l.Tracef("msg")
l.Debugf("msg")
l.Infof("msg")
l.Warnf("msg")
l.Errorf("msg")
l.Criticalf("msg")
l.Panicf("msg")
l.Fatalf("msg")
l.Tracew("msg")
l.Debugw("msg")
l.Infow("msg")
l.Warnw("msg")
l.Errorw("msg")
l.Criticalw("msg")
l.Panicw("msg")
l.Fatalw("msg")
l.Recover(nil)
assert.Nil(t, l.Sync())
})
}