logrus/hooks/null/null_test.go

20 lines
409 B
Go

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())
}