mirror of
https://github.com/redis/go-redis.git
synced 2025-09-02 22:01:16 +03:00
remove some logs
This commit is contained in:
@@ -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}
|
||||
}
|
||||
|
@@ -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())
|
||||
|
@@ -107,6 +107,9 @@ var _ = BeforeSuite(func() {
|
||||
filterLogger := internal.NewFilterLogger([]string{
|
||||
"ERR unknown subcommand 'maint_notifications'",
|
||||
"test panic",
|
||||
"sentinel:",
|
||||
"hitless:",
|
||||
"pubsub:",
|
||||
})
|
||||
redis.SetLogger(filterLogger)
|
||||
|
||||
|
@@ -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
|
||||
|
1
redis.go
1
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
|
||||
}
|
||||
|
Reference in New Issue
Block a user