hooks: add null logger test

This commit is contained in:
Simon Eskildsen
2017-05-12 15:15:51 -04:00
parent a9ab54b9d5
commit f1444e62a8
2 changed files with 29 additions and 8 deletions
+19
View File
@@ -0,0 +1,19 @@
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())
}