From 4a2802a702e9e6dd58b9302bf9e9cab558e0d7fe Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sat, 18 Apr 2020 17:45:01 +1000 Subject: [PATCH] Logging fixes --- peerconn.go | 3 ++- torrent.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/peerconn.go b/peerconn.go index bfc935e7..a2652da9 100644 --- a/peerconn.go +++ b/peerconn.go @@ -1124,9 +1124,10 @@ func (c *PeerConn) onReadExtendedMsg(id pp.ExtensionNumber, payload []byte) (err case pp.HandshakeExtendedID: var d pp.ExtendedHandshakeMessage if err := bencode.Unmarshal(payload, &d); err != nil { - c.t.logger.Printf("error parsing extended handshake message %q: %s", payload, err) + c.logger.Printf("error parsing extended handshake message %q: %s", payload, err) return errors.Wrap(err, "unmarshalling extended handshake payload") } + //c.logger.WithDefaultLevel(log.Debug).Printf("received extended handshake message:\n%s", spew.Sdump(d)) if d.Reqq != 0 { c.PeerMaxRequests = d.Reqq } diff --git a/torrent.go b/torrent.go index c2da92e2..998a05bc 100644 --- a/torrent.go +++ b/torrent.go @@ -270,7 +270,7 @@ func (t *Torrent) addPeer(p Peer) (added bool) { if replaced, ok := t.peers.AddReturningReplacedPeer(p); ok { torrent.Add("peers replaced", 1) if !replaced.Equal(p) { - t.logger.Printf("added %v replacing %v", p, replaced) + t.logger.WithDefaultLevel(log.Debug).Printf("added %v replacing %v", p, replaced) added = true } } else { @@ -1343,7 +1343,7 @@ func (t *Torrent) startScrapingTracker(_url string) { go func() { err := wst.TrackerClient.Run(ar, u.String()) if err != nil { - t.logger.WithDefaultLevel(log.Error).Printf( + t.logger.WithDefaultLevel(log.Warning).Printf( "error running websocket tracker announcer for %q: %v", u.String(), err) }