mirror of https://github.com/sirupsen/logrus.git
Compare commits
No commits in common. "a448f8228b920021d792e0767626068db5f0e38d" and "f8bf7650dccb756cea26edaf9217aab85500fe07" have entirely different histories.
a448f8228b
...
f8bf7650dc
|
@ -32,7 +32,7 @@ func NewGlobal() *Hook {
|
||||||
func NewLocal(logger *logrus.Logger) *Hook {
|
func NewLocal(logger *logrus.Logger) *Hook {
|
||||||
|
|
||||||
hook := new(Hook)
|
hook := new(Hook)
|
||||||
logger.AddHook(hook)
|
logger.Hooks.Add(hook)
|
||||||
|
|
||||||
return hook
|
return hook
|
||||||
|
|
||||||
|
|
|
@ -83,22 +83,3 @@ func TestFatalWithAlternateExit(t *testing.T) {
|
||||||
assert.Equal("something went very wrong", hook.LastEntry().Message)
|
assert.Equal("something went very wrong", hook.LastEntry().Message)
|
||||||
assert.Equal(1, len(hook.Entries))
|
assert.Equal(1, len(hook.Entries))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNewLocal(t *testing.T) {
|
|
||||||
assert := assert.New(t)
|
|
||||||
logger := logrus.New()
|
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
|
||||||
defer wg.Wait()
|
|
||||||
|
|
||||||
wg.Add(10)
|
|
||||||
for i := 0; i < 10; i++ {
|
|
||||||
go func(i int) {
|
|
||||||
logger.Info("info")
|
|
||||||
wg.Done()
|
|
||||||
}(i)
|
|
||||||
}
|
|
||||||
|
|
||||||
hook := NewLocal(logger)
|
|
||||||
assert.NotNil(hook)
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue