blob: c8b9213de48cdbeb5c5971b50f47a088e8fd72ed [file] [log] [blame]
Naveen Sampath04696f72022-06-13 15:19:14 +05301package internal
2
3import (
4 "context"
5 "fmt"
6 "log"
7 "os"
8)
9
10type Logging interface {
11 Printf(ctx context.Context, format string, v ...interface{})
12}
13
14type logger struct {
15 log *log.Logger
16}
17
18func (l *logger) Printf(ctx context.Context, format string, v ...interface{}) {
19 _ = l.log.Output(2, fmt.Sprintf(format, v...))
20}
21
22// Logger calls Output to print to the stderr.
23// Arguments are handled in the manner of fmt.Print.
24var Logger Logging = &logger{
25 log: log.New(os.Stderr, "redis: ", log.LstdFlags|log.Lshortfile),
26}