@@ -3,7 +3,6 @@ package pool
33import (
44 "context"
55 "errors"
6- "log"
76 "net"
87 "sync"
98 "sync/atomic"
@@ -386,7 +385,7 @@ func (p *ConnPool) getConn(ctx context.Context) (*Conn, error) {
386385 attempts := 0
387386 for {
388387 if attempts >= getAttempts {
389- log . Printf ("redis: connection pool: failed to get a connection accepted by hook after %d attempts" , attempts )
388+ internal . Logger . Printf (ctx , "redis: connection pool: failed to get a connection accepted by hook after %d attempts" , attempts )
390389 break
391390 }
392391 attempts ++
@@ -416,7 +415,7 @@ func (p *ConnPool) getConn(ctx context.Context) (*Conn, error) {
416415
417416 if hookManager != nil {
418417 if err := hookManager .ProcessOnGet (ctx , cn , false ); err != nil {
419- log . Printf ("redis: connection pool: failed to process idle connection by hook: %v" , err )
418+ internal . Logger . Printf (ctx , "redis: connection pool: failed to process idle connection by hook: %v" , err )
420419 // Failed to process connection, discard it
421420 _ = p .CloseConn (cn )
422421 continue
@@ -443,7 +442,7 @@ func (p *ConnPool) getConn(ctx context.Context) (*Conn, error) {
443442 if hookManager != nil {
444443 if err := hookManager .ProcessOnGet (ctx , newcn , true ); err != nil {
445444 // Failed to process connection, discard it
446- log . Printf ("redis: connection pool: failed to process new connection by hook: %v" , err )
445+ internal . Logger . Printf (ctx , "redis: connection pool: failed to process new connection by hook: %v" , err )
447446 _ = p .CloseConn (newcn )
448447 return nil , err
449448 }
@@ -539,7 +538,7 @@ func (p *ConnPool) popIdle() (*Conn, error) {
539538
540539 // If we exhausted all attempts without finding a usable connection, return nil
541540 if attempts >= popAttempts {
542- log . Printf ("redis: connection pool: failed to get a usable connection after %d attempts" , popAttempts )
541+ internal . Logger . Printf (context . Background (), "redis: connection pool: failed to get a usable connection after %d attempts" , popAttempts )
543542 return nil , nil
544543 }
545544
@@ -764,5 +763,3 @@ func (p *ConnPool) isHealthyConn(cn *Conn, now time.Time) bool {
764763 }
765764 return true
766765}
767-
768-
0 commit comments