From: Matt Joiner Date: Thu, 24 Apr 2025 13:06:15 +0000 (+1000) Subject: Include torrent info hash as logger context text X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=6ab4d18f231dfc5cc01f7e113e59a678a6536257;p=btrtrc.git Include torrent info hash as logger context text --- diff --git a/client.go b/client.go index 34a51644..99266c50 100644 --- a/client.go +++ b/client.go @@ -1384,7 +1384,8 @@ func (cl *Client) newTorrentOpt(opts AddTorrentOpts) (t *Torrent) { } t.smartBanCache.Init() t.networkingEnabled.Set() - t.logger = cl.logger.WithDefaultLevel(log.Debug).WithNames(t.InfoHash().HexString()) + ihHex := t.InfoHash().HexString() + t.logger = cl.logger.WithDefaultLevel(log.Debug).WithNames(ihHex).WithContextText(ihHex) t.sourcesLogger = t.logger.WithNames("sources") if opts.ChunkSize == 0 { opts.ChunkSize = defaultChunkSize