File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ func NewGlobal() *Hook {
32
32
func NewLocal (logger * logrus.Logger ) * Hook {
33
33
34
34
hook := new (Hook )
35
- logger .Hooks . Add (hook )
35
+ logger .AddHook (hook )
36
36
37
37
return hook
38
38
Original file line number Diff line number Diff line change @@ -83,3 +83,22 @@ func TestFatalWithAlternateExit(t *testing.T) {
83
83
assert .Equal ("something went very wrong" , hook .LastEntry ().Message )
84
84
assert .Equal (1 , len (hook .Entries ))
85
85
}
86
+
87
+ func TestNewLocal (t * testing.T ) {
88
+ assert := assert .New (t )
89
+ logger := logrus .New ()
90
+
91
+ var wg sync.WaitGroup
92
+ defer wg .Wait ()
93
+
94
+ wg .Add (10 )
95
+ for i := 0 ; i < 10 ; i ++ {
96
+ go func (i int ) {
97
+ logger .Info ("info" )
98
+ wg .Done ()
99
+ }(i )
100
+ }
101
+
102
+ hook := NewLocal (logger )
103
+ assert .NotNil (hook )
104
+ }
You can’t perform that action at this time.
0 commit comments