You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
522 B
27 lines
522 B
3 years ago
|
package internal
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"fmt"
|
||
|
"log"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
type Logging interface {
|
||
|
Printf(ctx context.Context, format string, v ...interface{})
|
||
|
}
|
||
|
|
||
|
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...))
|
||
|
}
|
||
|
|
||
|
// Logger calls Output to print to the stderr.
|
||
|
// Arguments are handled in the manner of fmt.Print.
|
||
|
var Logger Logging = &logger{
|
||
|
log: log.New(os.Stderr, "redis: ", log.LstdFlags|log.Lshortfile),
|
||
|
}
|