2
0
mirror of synced 2025-02-23 06:08:07 +00:00

Set torrent logger default level to debug

This commit is contained in:
Matt Joiner 2023-04-25 13:39:59 +10:00
parent 06a1aa0769
commit dc68e63298
No known key found for this signature in database
GPG Key ID: 6B990B8185E7F782
2 changed files with 5 additions and 5 deletions

View File

@ -783,7 +783,7 @@ func (cl *Client) establishOutgoingConnEx(
return nil, err
}
if err != nil {
log.Print(err)
t.logger.Print(err)
}
dialCtx, cancel := context.WithTimeout(context.Background(), func() time.Duration {
cl.rLock()
@ -1294,7 +1294,7 @@ func (cl *Client) newTorrentOpt(opts AddTorrentOpts) (t *Torrent) {
t.smartBanCache.Hash = sha1.Sum
t.smartBanCache.Init()
t.networkingEnabled.Set()
t.logger = cl.logger.WithContextValue(t).WithNames("torrent", t.infoHash.HexString())
t.logger = cl.logger.WithContextValue(t).WithNames("torrent", t.infoHash.HexString()).WithDefaultLevel(log.Debug)
t.sourcesLogger = t.logger.WithNames("sources")
if opts.ChunkSize == 0 {
opts.ChunkSize = defaultChunkSize

View File

@ -2723,7 +2723,7 @@ func sendUtHolepunchMsg(
func (t *Torrent) handleReceivedUtHolepunchMsg(msg utHolepunch.Msg, sender *PeerConn) error {
switch msg.MsgType {
case utHolepunch.Rendezvous:
log.Printf("got holepunch rendezvous request for %v from %p", msg.AddrPort, sender)
t.logger.Printf("got holepunch rendezvous request for %v from %p", msg.AddrPort, sender)
sendMsg := sendUtHolepunchMsg
targets := t.peerConnsWithRemoteAddrPort(msg.AddrPort)
if len(targets) == 0 {
@ -2740,7 +2740,7 @@ func (t *Torrent) handleReceivedUtHolepunchMsg(msg utHolepunch.Msg, sender *Peer
}
return nil
case utHolepunch.Connect:
log.Printf("got holepunch connect from %v for %v", sender, msg.AddrPort)
t.logger.Printf("got holepunch connect from %v for %v", sender, msg.AddrPort)
rz, ok := t.utHolepunchRendezvous[msg.AddrPort]
if ok {
delete(rz.relays, sender)
@ -2761,7 +2761,7 @@ func (t *Torrent) handleReceivedUtHolepunchMsg(msg utHolepunch.Msg, sender *Peer
delete(rz.relays, sender)
rz.relayCond.Broadcast()
}
log.Printf("received ut_holepunch error message from %v: %v", sender, msg.ErrCode)
t.logger.Printf("received ut_holepunch error message from %v: %v", sender, msg.ErrCode)
return nil
default:
return fmt.Errorf("unhandled msg type %v", msg.MsgType)