Skip to content

Commit f329fd5

Browse files
committed
remove some logs
1 parent b5e5760 commit f329fd5

File tree

5 files changed

+5
-20
lines changed

5 files changed

+5
-20
lines changed

internal/log.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,8 @@ var Logger Logging = &logger{
4343
}
4444

4545
func NewFilterLogger(substr []string) Logging {
46-
l := Logger
47-
if _, ok := l.(*logger); !ok {
48-
l = &logger{
49-
log: log.New(os.Stderr, "redis: ", log.LstdFlags|log.Lshortfile),
50-
}
46+
l := &logger{
47+
log: log.New(os.Stderr, "redis: ", log.LstdFlags|log.Lshortfile),
5148
}
5249
return &filterLogger{logger: l, substr: substr}
5350
}

internal/pool/pubsub.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import (
55
"net"
66
"sync"
77
"sync/atomic"
8-
9-
"github.com/redis/go-redis/v9/internal"
108
)
119

1210
type PubSubStats struct {
@@ -55,9 +53,6 @@ func (p *PubSubPool) TrackConn(cn *Conn) {
5553
}
5654

5755
func (p *PubSubPool) UntrackConn(cn *Conn) {
58-
if !cn.IsUsable() || cn.ShouldHandoff() {
59-
internal.Logger.Printf(context.Background(), "pubsub: untracking conn[%d] [usable, handoff] = [%v, %v]", cn.GetID(), cn.IsUsable(), cn.ShouldHandoff())
60-
}
6156
atomic.AddUint32(&p.stats.Active, ^uint32(0))
6257
atomic.AddUint32(&p.stats.Untracked, 1)
6358
p.activeConns.Delete(cn.GetID())

main_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ var _ = BeforeSuite(func() {
107107
filterLogger := internal.NewFilterLogger([]string{
108108
"ERR unknown subcommand 'maint_notifications'",
109109
"test panic",
110+
"sentinel:",
111+
"hitless:",
112+
"pubsub:",
110113
})
111114
redis.SetLogger(filterLogger)
112115

pubsub.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,10 @@ func (c *PubSub) releaseConn(ctx context.Context, cn *pool.Conn, err error, allo
170170
}
171171

172172
if !cn.IsUsable() || cn.ShouldHandoff() {
173-
if cn.ShouldHandoff() {
174-
internal.Logger.Printf(ctx, "pubsub: connection[%d] is marked for handoff, reconnecting", cn.GetID())
175-
} else {
176-
internal.Logger.Printf(ctx, "pubsub: connection[%d] is not usable, reconnecting", cn.GetID())
177-
}
178173
c.reconnect(ctx, fmt.Errorf("pubsub: connection is not usable"))
179174
}
180175

181176
if isBadConn(err, allowTimeout, c.opt.Addr) {
182-
internal.Logger.Printf(ctx, "pubsub: releasing connection[%d]: %v", cn.GetID(), err)
183177
c.reconnect(ctx, err)
184178
}
185179
}
@@ -207,9 +201,6 @@ func (c *PubSub) closeTheCn(reason error) error {
207201
if c.cn == nil {
208202
return nil
209203
}
210-
if !c.closed {
211-
internal.Logger.Printf(c.getContext(), "redis: discarding bad PubSub connection[%d]: %s, %v", c.cn.GetID(), reason, c.cn.RemoteAddr())
212-
}
213204
err := c.closeConn(c.cn)
214205
c.cn = nil
215206
return err

redis.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,6 @@ func (c *Client) pubSub() *PubSub {
10791079
// will return nil if already initialized
10801080
err = c.initConn(ctx, cn)
10811081
if err != nil {
1082-
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)
10831082
_ = cn.Close()
10841083
return nil, err
10851084
}

0 commit comments

Comments
 (0)