src.dualinventive.com/go/lib/dilog/testlogger_test.go

24 lines
453 B
Go

package dilog
import (
"errors"
"testing"
"github.com/sirupsen/logrus"
)
func TestTestLogger(t *testing.T) {
l := NewTestLogger(t)
l.Error("This is a test")
l.WithField("foo", "bar").Warning("This is a test with fields")
l.WithError(errors.New("hello")).Debug("debug message")
}
func TestTestLoggerDefaultLogger(t *testing.T) {
NewTestLogger(t)
logrus.Warn("default logrus message with stdlogger")
logrus.Infof("info message: %d", 10)
}