Skip to content

Commit

Permalink
Merge pull request redis#1285 from kudrykv/issue-1279
Browse files Browse the repository at this point in the history
Use an interface for logging
  • Loading branch information
vmihailenco authored May 21, 2020
2 parents d9e2420 + 3927269 commit a7c11d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion internal/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 1 addition & 2 deletions redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package redis
import (
"context"
"fmt"
"log"
"time"

"github.com/go-redis/redis/v7/internal"
Expand All @@ -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
}

Expand Down

0 comments on commit a7c11d9

Please sign in to comment.