Tidy up some logging
This commit is contained in:
parent
d3daaaf75a
commit
a9102abf1d
|
@ -1350,14 +1350,14 @@ func (cl *Client) newConnection(nc net.Conn, outgoing bool, remoteAddr net.Addr,
|
||||||
writeBuffer: new(bytes.Buffer),
|
writeBuffer: new(bytes.Buffer),
|
||||||
}
|
}
|
||||||
c.peerImpl = c
|
c.peerImpl = c
|
||||||
c.logger = cl.logger.WithDefaultLevel(log.Debug).WithContextValue(c)
|
c.logger = cl.logger.WithDefaultLevel(log.Warning).WithContextValue(c)
|
||||||
c.writerCond.L = cl.locker()
|
c.writerCond.L = cl.locker()
|
||||||
c.setRW(connStatsReadWriter{nc, c})
|
c.setRW(connStatsReadWriter{nc, c})
|
||||||
c.r = &rateLimitedReader{
|
c.r = &rateLimitedReader{
|
||||||
l: cl.config.DownloadRateLimiter,
|
l: cl.config.DownloadRateLimiter,
|
||||||
r: c.r,
|
r: c.r,
|
||||||
}
|
}
|
||||||
c.logger.Printf("initialized with remote %v over network %v (outgoing=%t)", remoteAddr, network, outgoing)
|
c.logger.WithDefaultLevel(log.Debug).Printf("initialized with remote %v over network %v (outgoing=%t)", remoteAddr, network, outgoing)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1341,7 +1341,7 @@ func (c *peer) receiveChunk(msg *pp.Message) error {
|
||||||
piece.decrementPendingWrites()
|
piece.decrementPendingWrites()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.logger.Printf("error writing received chunk %v: %v", req, err)
|
c.logger.WithDefaultLevel(log.Error).Printf("writing received chunk %v: %v", req, err)
|
||||||
t.pendRequest(req)
|
t.pendRequest(req)
|
||||||
//t.updatePieceCompletion(pieceIndex(msg.Index))
|
//t.updatePieceCompletion(pieceIndex(msg.Index))
|
||||||
t.onWriteChunkErr(err)
|
t.onWriteChunkErr(err)
|
||||||
|
@ -1553,7 +1553,7 @@ func (c *PeerConn) setTorrent(t *Torrent) {
|
||||||
panic("connection already associated with a torrent")
|
panic("connection already associated with a torrent")
|
||||||
}
|
}
|
||||||
c.t = t
|
c.t = t
|
||||||
c.logger.Printf("torrent=%v", t)
|
c.logger.WithDefaultLevel(log.Debug).Printf("set torrent=%v", t)
|
||||||
t.reconcileHandshakeStats(c)
|
t.reconcileHandshakeStats(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,8 @@ func (s *pexConnState) Init(c *PeerConn) {
|
||||||
s.xid = xid
|
s.xid = xid
|
||||||
s.seq = 0
|
s.seq = 0
|
||||||
s.torrent = c.t
|
s.torrent = c.t
|
||||||
s.info = c.t.cl.logger
|
s.info = c.t.cl.logger.WithDefaultLevel(log.Info)
|
||||||
s.dbg = c.logger
|
s.dbg = c.logger.WithDefaultLevel(log.Debug)
|
||||||
s.readyfn = c.tickleWriter
|
s.readyfn = c.tickleWriter
|
||||||
s.gate = make(chan struct{}, 1)
|
s.gate = make(chan struct{}, 1)
|
||||||
s.timer = time.AfterFunc(0, func() {
|
s.timer = time.AfterFunc(0, func() {
|
||||||
|
|
Loading…
Reference in New Issue