logrus/hooks/null/null_test.go

20 lines
409 B
Go
Raw Normal View History

2017-05-12 22:15:51 +03:00
package null
import (
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"testing"
)
func TestNullLogger(t *testing.T) {
logger, hook := NewNullLogger()
logger.Error("Helloerror")
assert.Equal(t, 1, len(hook.Entries))
assert.Equal(t, logrus.ErrorLevel, hook.LastEntry().Level)
assert.Equal(t, "Helloerror", hook.LastEntry().Message)
hook.Reset()
assert.Nil(t, hook.LastEntry())
}