2016-04-09 14:52:01 +03:00
|
|
|
package internal
|
|
|
|
|
|
|
|
import (
|
2020-07-18 09:04:36 +03:00
|
|
|
"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 {
|
2020-07-18 09:04:36 +03:00
|
|
|
Printf(ctx context.Context, format string, v ...interface{})
|
2020-03-30 17:02:17 +03:00
|
|
|
}
|
|
|
|
|
2020-07-18 09:04:36 +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...))
|
|
|
|
}
|
|
|
|
|
2021-05-13 05:33:38 +03:00
|
|
|
// Logger calls Output to print to the stderr.
|
|
|
|
// Arguments are handled in the manner of fmt.Print.
|
2020-07-18 09:04:36 +03:00
|
|
|
var Logger Logging = &logger{
|
|
|
|
log: log.New(os.Stderr, "redis: ", log.LstdFlags|log.Lshortfile),
|
|
|
|
}
|