2
0
mirror of synced 2025-02-23 14:18:13 +00:00

Logging improvements for DHT

This commit is contained in:
Matt Joiner 2020-03-17 13:48:09 +11:00
parent c83738f3f4
commit 378ccd0932
2 changed files with 4 additions and 2 deletions

View File

@ -318,7 +318,9 @@ func (cl *Client) newAnacrolixDhtServer(conn net.PacketConn) (s *dht.Server, err
StartingNodes: cl.config.DhtStartingNodes(conn.LocalAddr().Network()),
ConnectionTracking: cl.config.ConnTracker,
OnQuery: cl.config.DHTOnQuery,
Logger: cl.logger.WithValues("dht", conn.LocalAddr().String()),
Logger: cl.logger.WithText(func(m log.Msg) string {
return fmt.Sprintf("dht server on %v: %s", conn.LocalAddr().String(), m.Text())
}),
}
s, err = dht.NewServer(&cfg)
if err == nil {

View File

@ -1384,7 +1384,7 @@ func (t *Torrent) dhtAnnouncer(s DhtServer) {
cl.unlock()
err := t.announceToDht(true, s)
if err != nil {
t.logger.Printf("error announcing %q to DHT: %s", t, err)
t.logger.WithValues(log.Warning).Printf("error announcing %q to DHT: %s", t, err)
}
}
}