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 {
3232func NewLocal (logger * logrus.Logger ) * Hook {
3333
3434 hook := new (Hook )
35- logger .Hooks . Add (hook )
35+ logger .AddHook (hook )
3636
3737 return hook
3838
Original file line number Diff line number Diff line change @@ -83,3 +83,22 @@ func TestFatalWithAlternateExit(t *testing.T) {
8383 assert .Equal ("something went very wrong" , hook .LastEntry ().Message )
8484 assert .Equal (1 , len (hook .Entries ))
8585}
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