serkant.uluderya | e5afeff | 2021-02-23 18:00:23 +0300 | [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 | } |