mirror of
https://github.com/redis/go-redis.git
synced 2025-09-05 20:24:00 +03:00
remove some logs
This commit is contained in:
@@ -43,11 +43,8 @@ var Logger Logging = &logger{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewFilterLogger(substr []string) Logging {
|
func NewFilterLogger(substr []string) Logging {
|
||||||
l := Logger
|
l := &logger{
|
||||||
if _, ok := l.(*logger); !ok {
|
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}
|
return &filterLogger{logger: l, substr: substr}
|
||||||
}
|
}
|
||||||
|
@@ -5,8 +5,6 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9/internal"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type PubSubStats struct {
|
type PubSubStats struct {
|
||||||
@@ -55,9 +53,6 @@ func (p *PubSubPool) TrackConn(cn *Conn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *PubSubPool) UntrackConn(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.Active, ^uint32(0))
|
||||||
atomic.AddUint32(&p.stats.Untracked, 1)
|
atomic.AddUint32(&p.stats.Untracked, 1)
|
||||||
p.activeConns.Delete(cn.GetID())
|
p.activeConns.Delete(cn.GetID())
|
||||||
|
@@ -107,6 +107,9 @@ var _ = BeforeSuite(func() {
|
|||||||
filterLogger := internal.NewFilterLogger([]string{
|
filterLogger := internal.NewFilterLogger([]string{
|
||||||
"ERR unknown subcommand 'maint_notifications'",
|
"ERR unknown subcommand 'maint_notifications'",
|
||||||
"test panic",
|
"test panic",
|
||||||
|
"sentinel:",
|
||||||
|
"hitless:",
|
||||||
|
"pubsub:",
|
||||||
})
|
})
|
||||||
redis.SetLogger(filterLogger)
|
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.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"))
|
c.reconnect(ctx, fmt.Errorf("pubsub: connection is not usable"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if isBadConn(err, allowTimeout, c.opt.Addr) {
|
if isBadConn(err, allowTimeout, c.opt.Addr) {
|
||||||
internal.Logger.Printf(ctx, "pubsub: releasing connection[%d]: %v", cn.GetID(), err)
|
|
||||||
c.reconnect(ctx, err)
|
c.reconnect(ctx, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,9 +201,6 @@ func (c *PubSub) closeTheCn(reason error) error {
|
|||||||
if c.cn == nil {
|
if c.cn == nil {
|
||||||
return 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)
|
err := c.closeConn(c.cn)
|
||||||
c.cn = nil
|
c.cn = nil
|
||||||
return err
|
return err
|
||||||
|
1
redis.go
1
redis.go
@@ -1079,7 +1079,6 @@ func (c *Client) pubSub() *PubSub {
|
|||||||
// will return nil if already initialized
|
// will return nil if already initialized
|
||||||
err = c.initConn(ctx, cn)
|
err = c.initConn(ctx, cn)
|
||||||
if err != nil {
|
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()
|
_ = cn.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user