Skip to content

Commit

Permalink
Revert "Enable go-redis logger"
Browse files Browse the repository at this point in the history
This reverts commit a358354.
Set global redis logger is not safe in multiple nodes situation.
  • Loading branch information
j178 committed Aug 3, 2022
1 parent 4ecfa17 commit 67b3d05
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 0 additions & 3 deletions node.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
"sync"
"time"

"github.com/go-redis/redis/v8"

"github.com/centrifugal/centrifuge/internal/controlpb"
"github.com/centrifugal/centrifuge/internal/controlproto"
"github.com/centrifugal/centrifuge/internal/dissolve"
Expand Down Expand Up @@ -162,7 +160,6 @@ func New(c Config) (*Node, error) {
if c.LogHandler != nil {
n.logger = newLogger(c.LogLevel, c.LogHandler)
}
redis.SetLogger(redisLogger{n})

b, err := NewMemoryBroker(n, MemoryBrokerConfig{})
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions redis_shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ const (
redisDataBatchLimit = 64
)

type redisLogger struct{
n *Node
}
type redisLogger struct{}

func (redisLogger) Printf(ctx context.Context, format string, v ...interface{}) {}

func (l redisLogger) Printf(ctx context.Context, format string, v ...interface{}) {
l.n.Log(NewLogEntry(LogLevelInfo, fmt.Sprintf(format, v...)))
func init() {
redis.SetLogger(redisLogger{})
}

type RedisShard struct {
Expand Down

0 comments on commit 67b3d05

Please sign in to comment.