diff --git a/torrent.go b/torrent.go index a974db28..51a8cce5 100644 --- a/torrent.go +++ b/torrent.go @@ -1320,11 +1320,13 @@ func (t *Torrent) startScrapingTracker(_url string) { wst := websocketTracker{*u, webtorrent.NewTrackerClient(t.cl.peerID, t.infoHash, t.onWebRtcConn, t.logger.WithText(func(m log.Msg) string { return fmt.Sprintf("%q: %v", u.String(), m.Text()) - }))} + }).WithValues(log.Debug))} go func() { err := wst.TrackerClient.Run(t.announceRequest(tracker.Started), u.String()) if err != nil { - t.logger.WithValues(log.Error).Printf("error running websocket tracker announcer: %v", err) + t.logger.WithValues(log.Error).Printf( + "error running websocket tracker announcer for %q: %v", + u.String(), err) } }() return wst diff --git a/webtorrent/tracker_client.go b/webtorrent/tracker_client.go index d66a54a2..8039e8ce 100644 --- a/webtorrent/tracker_client.go +++ b/webtorrent/tracker_client.go @@ -130,11 +130,11 @@ func (c *TrackerClient) trackerReadLoop() error { var ar AnnounceResponse if err := json.Unmarshal(message, &ar); err != nil { - log.Printf("error unmarshaling announce response: %v", err) + c.logger.Printf("error unmarshaling announce response: %v", err) continue } if ar.InfoHash != c.infoHashBinary { - log.Printf("announce response for different hash: expected %q got %q", c.infoHashBinary, ar.InfoHash) + c.logger.Printf("announce response for different hash: expected %q got %q", c.infoHashBinary, ar.InfoHash) continue } switch {