mirror of https://github.com/go-redis/redis.git
Merge pull request #1285 from kudrykv/issue-1279
Use an interface for logging
This commit is contained in:
commit
a7c11d9699
|
@ -5,4 +5,8 @@ import (
|
||||||
"os"
|
"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)
|
||||||
|
|
3
redis.go
3
redis.go
|
@ -3,7 +3,6 @@ package redis
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-redis/redis/v7/internal"
|
"github.com/go-redis/redis/v7/internal"
|
||||||
|
@ -14,7 +13,7 @@ import (
|
||||||
// Nil reply returned by Redis when key does not exist.
|
// Nil reply returned by Redis when key does not exist.
|
||||||
const Nil = proto.Nil
|
const Nil = proto.Nil
|
||||||
|
|
||||||
func SetLogger(logger *log.Logger) {
|
func SetLogger(logger internal.Logging) {
|
||||||
internal.Logger = logger
|
internal.Logger = logger
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue