Remove annoying logs

This commit is contained in:
Ben Sarmiento
2024-01-28 18:27:39 +01:00
parent 00e4f8013c
commit 0678af2bc2
6 changed files with 57 additions and 28 deletions

View File

@@ -52,7 +52,7 @@ func (dl *Downloader) DownloadFile(directory, torrentName, fileName string, resp
return
}
log.Debugf("Opening file %s from torrent %s (%s)", fileName, torMgr.GetKey(torrent), file.Link)
// log.Debugf("Opening file %s from torrent %s (%s)", fileName, torMgr.GetKey(torrent), file.Link)
unrestrict := torMgr.UnrestrictUntilOk(file.Link)
if unrestrict == nil {
@@ -102,7 +102,7 @@ func (dl *Downloader) DownloadLink(fileName, link string, resp http.ResponseWrit
return
}
log.Debugf("Opening file %s (%s)", fileName, link)
// log.Debugf("Opening file %s (%s)", fileName, link)
unrestrict := torMgr.UnrestrictUntilOk(link)
if unrestrict == nil {
@@ -151,17 +151,17 @@ func (dl *Downloader) streamFileToResponse(torrent *intTor.Torrent, file *intTor
}
// copy range header if it exists
rangeLog := ""
// rangeLog := ""
if req.Header.Get("Range") != "" {
dlReq.Header.Add("Range", req.Header.Get("Range"))
rangeLog = " (range: " + req.Header.Get("Range") + ")"
// rangeLog = " (range: " + req.Header.Get("Range") + ")"
}
if torrent != nil {
log.Debugf("Downloading unrestricted link %s from torrent %s (%s)%s", unrestrict.Download, torMgr.GetKey(torrent), unrestrict.Link, rangeLog)
} else {
log.Debugf("Downloading unrestricted link %s (%s)%s", unrestrict.Download, unrestrict.Link, rangeLog)
}
// if torrent != nil {
// log.Debugf("Downloading unrestricted link %s from torrent %s (%s)%s", unrestrict.Download, torMgr.GetKey(torrent), unrestrict.Link, rangeLog)
// } else {
// log.Debugf("Downloading unrestricted link %s (%s)%s", unrestrict.Download, unrestrict.Link, rangeLog)
// }
download, err := dl.client.Do(dlReq)
if err != nil {
@@ -199,7 +199,7 @@ func (dl *Downloader) streamFileToResponse(torrent *intTor.Torrent, file *intTor
}
}
log.Debugf("Serving file %s%s", unrestrict.Download, rangeLog)
// log.Debugf("Serving file %s%s", unrestrict.Download, rangeLog)
buf := make([]byte, cfg.GetNetworkBufferSize())
io.CopyBuffer(resp, download.Body, buf)