From 39272697aad41f852a4fd0c62e70693cface872e Mon Sep 17 00:00:00 2001 From: Vitaliy Kudryk Date: Mon, 30 Mar 2020 17:02:17 +0300 Subject: [PATCH] issue-1279 update logging --- internal/log.go | 6 +++++- redis.go | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/log.go b/internal/log.go index 405a2728d..49cef75fb 100644 --- a/internal/log.go +++ b/internal/log.go @@ -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) diff --git a/redis.go b/redis.go index 93032579c..3e02b84a7 100644 --- a/redis.go +++ b/redis.go @@ -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 }