[log] add NewFilterByLevel helper func

This commit is contained in:
Anton Kaliaev
2017-05-12 22:47:02 +02:00
parent dd592a21b9
commit 3007668274
2 changed files with 31 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/tendermint/tmlibs/log"
)
@ -107,3 +108,15 @@ func TestLevelContext(t *testing.T) {
t.Errorf("\nwant '%s'\nhave '%s'", want, have)
}
}
func TestNewFilterByLevel(t *testing.T) {
assert := assert.New(t)
var logger log.Logger
logger = log.NewNopLogger()
assert.NotPanics(func() {
logger = log.NewFilterByLevel(logger, "info")
})
assert.Panics(func() {
logger = log.NewFilterByLevel(logger, "smth")
})
}