(tested) complete replace logrus with zerolog

* remove cobra dependency and split execs to mochi and e2e

* add log init synchronization
This commit is contained in:
Lawrence, Rendall
2022-05-02 03:13:58 +03:00
parent 4d646f7c09
commit c50a532181
36 changed files with 753 additions and 707 deletions

View File

@@ -5,6 +5,7 @@ import (
)
var (
logger = log.NewLogger("bittorrent")
// ErrInvalidIP indicates an invalid IP for an Announce.
ErrInvalidIP = ClientError("invalid IP")
@@ -29,12 +30,7 @@ func SanitizeAnnounce(r *AnnounceRequest, maxNumWant, defaultNumWant uint32) err
r.NumWant = maxNumWant
}
log.Debug("sanitized announce", r, log.Fields{
"port": r.Port,
"addresses": r.RequestAddresses,
"maxNumWant": maxNumWant,
"defaultNumWant": defaultNumWant,
})
logger.Debug().Object("request", r).Msg("sanitized announce")
return nil
}
@@ -49,9 +45,6 @@ func SanitizeScrape(r *ScrapeRequest, maxScrapeInfoHashes uint32) error {
return ErrInvalidIP
}
log.Debug("sanitized scrape", r, log.Fields{
"addresses": r.RequestAddresses,
"maxScrapeInfoHashes": maxScrapeInfoHashes,
})
logger.Debug().Object("request", r).Msg("sanitized scrape")
return nil
}