mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-22 08:23:50 +01:00
21 lines
398 B
Go
21 lines
398 B
Go
package util
|
|
|
|
import "fmt"
|
|
|
|
type Logger interface {
|
|
Printf(format string, args ...interface{})
|
|
}
|
|
|
|
type PrefixLogger struct {
|
|
Log Logger
|
|
Prefix string
|
|
}
|
|
|
|
func NewPrefixLogger(logger Logger, prefix string) (l PrefixLogger) {
|
|
return PrefixLogger{logger, prefix}
|
|
}
|
|
|
|
func (l PrefixLogger) Printf(format string, v ...interface{}) {
|
|
l.Log.Printf(fmt.Sprintf("[%s]: %s", l.Prefix, format), v...)
|
|
}
|