redis/internal/log.go

25 lines
422 B
Go
Raw Permalink Normal View History

2016-04-09 14:52:01 +03:00
package internal
import (
"context"
"fmt"
2016-04-09 14:52:01 +03:00
"log"
2019-06-17 12:32:40 +03:00
"os"
2016-04-09 14:52:01 +03:00
)
2020-03-30 17:02:17 +03:00
type Logging interface {
Printf(ctx context.Context, format string, v ...interface{})
2020-03-30 17:02:17 +03:00
}
type logger struct {
log *log.Logger
}
func (l *logger) Printf(ctx context.Context, format string, v ...interface{}) {
_ = l.log.Output(2, fmt.Sprintf(format, v...))
}
var Logger Logging = &logger{
log: log.New(os.Stderr, "redis: ", log.LstdFlags|log.Lshortfile),
}