Fix logger.StdLogger to really be a plugin stdlib/log.Logger.

This commit is contained in:
Antoine Grondin 2014-03-14 14:50:08 -04:00
parent 57071602e3
commit 97e1bef2cc
2 changed files with 19 additions and 1 deletions

View File

@ -33,7 +33,7 @@ const (
type StandardLogger interface { type StandardLogger interface {
Print(...interface{}) Print(...interface{})
Printf(string, ...interface{}) Printf(string, ...interface{})
Printfln(...interface{}) Println(...interface{})
Fatal(...interface{}) Fatal(...interface{})
Fatalf(string, ...interface{}) Fatalf(string, ...interface{})

View File

@ -33,6 +33,24 @@ func TestPrint(t *testing.T) {
}) })
} }
func TestPrintf(t *testing.T) {
LogAndAssertJSON(t, func(log *Logger) {
log.Printf("%s", "test")
}, func(fields Fields) {
assert.Equal(t, fields["msg"], "test")
assert.Equal(t, fields["level"], "info")
})
}
func TestPrintln(t *testing.T) {
LogAndAssertJSON(t, func(log *Logger) {
log.Println("test")
}, func(fields Fields) {
assert.Equal(t, fields["msg"], "test")
assert.Equal(t, fields["level"], "info")
})
}
func TestInfo(t *testing.T) { func TestInfo(t *testing.T) {
LogAndAssertJSON(t, func(log *Logger) { LogAndAssertJSON(t, func(log *Logger) {
log.Info("test") log.Info("test")