Merge pull request #1285 from kudrykv/issue-1279

Use an interface for logging
This commit is contained in:
Vladimir Mihailenco 2020-05-21 10:08:11 +03:00 committed by GitHub
commit a7c11d9699
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -5,4 +5,8 @@ import (
"os"
)
var Logger = log.New(os.Stderr, "redis: ", log.LstdFlags|log.Lshortfile)
type Logging interface {
Printf(format string, v ...interface{})
}
var Logger Logging = log.New(os.Stderr, "redis: ", log.LstdFlags|log.Lshortfile)

View File

@ -3,7 +3,6 @@ package redis
import (
"context"
"fmt"
"log"
"time"
"github.com/go-redis/redis/v7/internal"
@ -14,7 +13,7 @@ import (
// Nil reply returned by Redis when key does not exist.
const Nil = proto.Nil
func SetLogger(logger *log.Logger) {
func SetLogger(logger internal.Logging) {
internal.Logger = logger
}