mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-13 05:11:21 +00:00
log logger's errors (Refs #29)
This commit is contained in:
@ -1,12 +1,26 @@
|
||||
package log_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/go-logfmt/logfmt"
|
||||
"github.com/tendermint/tmlibs/log"
|
||||
)
|
||||
|
||||
func TestLoggerLogsItsErrors(t *testing.T) {
|
||||
var buf bytes.Buffer
|
||||
|
||||
logger := log.NewTMLogger(&buf)
|
||||
logger.Info("foo", "baz baz", "bar")
|
||||
msg := strings.TrimSpace(buf.String())
|
||||
if !strings.Contains(msg, logfmt.ErrInvalidKey.Error()) {
|
||||
t.Errorf("Expected logger msg to contain ErrInvalidKey, got %s", msg)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkTMLoggerSimple(b *testing.B) {
|
||||
benchmarkRunner(b, log.NewTMLogger(ioutil.Discard), baseInfoMessage)
|
||||
}
|
||||
|
Reference in New Issue
Block a user