mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-24 17:35:01 +01:00
29 lines
426 B
Go
29 lines
426 B
Go
package logger
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
type testLogger struct {
|
|
Logger
|
|
}
|
|
|
|
type testingLoggerOutlet struct {
|
|
t *testing.T
|
|
}
|
|
|
|
func (o testingLoggerOutlet) WriteEntry(entry Entry) error {
|
|
o.t.Logf("%#v", entry)
|
|
return nil
|
|
}
|
|
|
|
var _ Logger = testLogger{}
|
|
|
|
func NewTestLogger(t *testing.T) Logger {
|
|
outlets := NewOutlets()
|
|
outlets.Add(&testingLoggerOutlet{t}, Debug)
|
|
return &testLogger{
|
|
Logger: NewLogger(outlets, 0),
|
|
}
|
|
}
|