mirror of
https://github.com/zrepl/zrepl.git
synced 2025-01-05 05:48:57 +01:00
logger: add stderrlogger (sometimes useful)
This commit is contained in:
parent
68b62a5c00
commit
ef3283638a
27
logger/stderrlogger.go
Normal file
27
logger/stderrlogger.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package logger
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
type stderrLogger struct {
|
||||||
|
Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
type stderrLoggerOutlet struct {}
|
||||||
|
|
||||||
|
func (stderrLoggerOutlet) WriteEntry(entry Entry) error {
|
||||||
|
fmt.Fprintf(os.Stderr, "%#v\n", entry)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ Logger = testLogger{}
|
||||||
|
|
||||||
|
func NewStderrDebugLogger() Logger {
|
||||||
|
outlets := NewOutlets()
|
||||||
|
outlets.Add(&stderrLoggerOutlet{}, Debug)
|
||||||
|
return &testLogger{
|
||||||
|
Logger: NewLogger(outlets, 0),
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user