diff --git a/internal/log.go b/internal/log.go index 2044ecbd..48d278ed 100644 --- a/internal/log.go +++ b/internal/log.go @@ -43,11 +43,8 @@ var Logger Logging = &logger{ } func NewFilterLogger(substr []string) Logging { - l := Logger - if _, ok := l.(*logger); !ok { - l = &logger{ - log: log.New(os.Stderr, "redis: ", log.LstdFlags|log.Lshortfile), - } + l := &logger{ + log: log.New(os.Stderr, "redis: ", log.LstdFlags|log.Lshortfile), } return &filterLogger{logger: l, substr: substr} } diff --git a/internal/pool/pubsub.go b/internal/pool/pubsub.go index 8b12f74c..73ee4b3e 100644 --- a/internal/pool/pubsub.go +++ b/internal/pool/pubsub.go @@ -5,8 +5,6 @@ import ( "net" "sync" "sync/atomic" - - "github.com/redis/go-redis/v9/internal" ) type PubSubStats struct { @@ -55,9 +53,6 @@ func (p *PubSubPool) TrackConn(cn *Conn) { } func (p *PubSubPool) UntrackConn(cn *Conn) { - if !cn.IsUsable() || cn.ShouldHandoff() { - internal.Logger.Printf(context.Background(), "pubsub: untracking conn[%d] [usable, handoff] = [%v, %v]", cn.GetID(), cn.IsUsable(), cn.ShouldHandoff()) - } atomic.AddUint32(&p.stats.Active, ^uint32(0)) atomic.AddUint32(&p.stats.Untracked, 1) p.activeConns.Delete(cn.GetID()) diff --git a/main_test.go b/main_test.go index 05645fff..9f9d0580 100644 --- a/main_test.go +++ b/main_test.go @@ -107,6 +107,9 @@ var _ = BeforeSuite(func() { filterLogger := internal.NewFilterLogger([]string{ "ERR unknown subcommand 'maint_notifications'", "test panic", + "sentinel:", + "hitless:", + "pubsub:", }) redis.SetLogger(filterLogger) diff --git a/pubsub.go b/pubsub.go index 09d4917f..0f535a03 100644 --- a/pubsub.go +++ b/pubsub.go @@ -170,16 +170,10 @@ func (c *PubSub) releaseConn(ctx context.Context, cn *pool.Conn, err error, allo } if !cn.IsUsable() || cn.ShouldHandoff() { - if cn.ShouldHandoff() { - internal.Logger.Printf(ctx, "pubsub: connection[%d] is marked for handoff, reconnecting", cn.GetID()) - } else { - internal.Logger.Printf(ctx, "pubsub: connection[%d] is not usable, reconnecting", cn.GetID()) - } c.reconnect(ctx, fmt.Errorf("pubsub: connection is not usable")) } if isBadConn(err, allowTimeout, c.opt.Addr) { - internal.Logger.Printf(ctx, "pubsub: releasing connection[%d]: %v", cn.GetID(), err) c.reconnect(ctx, err) } } @@ -207,9 +201,6 @@ func (c *PubSub) closeTheCn(reason error) error { if c.cn == nil { return nil } - if !c.closed { - internal.Logger.Printf(c.getContext(), "redis: discarding bad PubSub connection[%d]: %s, %v", c.cn.GetID(), reason, c.cn.RemoteAddr()) - } err := c.closeConn(c.cn) c.cn = nil return err diff --git a/redis.go b/redis.go index b896196f..ba0d3a14 100644 --- a/redis.go +++ b/redis.go @@ -1079,7 +1079,6 @@ func (c *Client) pubSub() *PubSub { // will return nil if already initialized err = c.initConn(ctx, cn) if err != nil { - internal.Logger.Printf(ctx, "pubsub: conn[%d] to ADDR %s [usable, handoff] = [%v, %v] after initConn returned %v", cn.GetID(), addr, cn.IsUsable(), cn.ShouldHandoff(), err) _ = cn.Close() return nil, err }