Joey Armstrong | 5f51f2e | 2023-01-17 17:06:26 -0500 | [diff] [blame] | 1 | package internal |
2 | |||||
3 | import ( | ||||
4 | "context" | ||||
5 | "fmt" | ||||
6 | "log" | ||||
7 | "os" | ||||
8 | ) | ||||
9 | |||||
10 | type Logging interface { | ||||
11 | Printf(ctx context.Context, format string, v ...interface{}) | ||||
12 | } | ||||
13 | |||||
14 | type logger struct { | ||||
15 | log *log.Logger | ||||
16 | } | ||||
17 | |||||
18 | func (l *logger) Printf(ctx context.Context, format string, v ...interface{}) { | ||||
19 | _ = l.log.Output(2, fmt.Sprintf(format, v...)) | ||||
20 | } | ||||
21 | |||||
22 | var Logger Logging = &logger{ | ||||
23 | log: log.New(os.Stderr, "redis: ", log.LstdFlags|log.Lshortfile), | ||||
24 | } |