This commit is contained in:
parent
7732649b4b
commit
acfe320b8b
2 changed files with 17 additions and 2 deletions
|
|
@ -18,7 +18,7 @@ public static class Logger
|
|||
|
||||
var done = (Int32)((Double)download.BytesDone / download.BytesTotal * 100);
|
||||
|
||||
return $"for download {fileName} {done}% ({download.DownloadId})";
|
||||
return $"for download {fileName}. Completed: {done}%, avg speed: {download.Speed}bytes/s ({download.DownloadId})";
|
||||
}
|
||||
|
||||
public static String ToLog(this Torrent torrent)
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ public class TorrentRunner
|
|||
if (!String.IsNullOrWhiteSpace(downloadClient.Error))
|
||||
{
|
||||
// Retry the download if an error is encountered.
|
||||
Log($"Download reported an error: {downloadClient.Error}", download, download.Torrent);
|
||||
LogError($"Download reported an error: {downloadClient.Error}", download, download.Torrent);
|
||||
Log($"Download retry count {download.RetryCount}/{download.Torrent!.DownloadRetryAttempts}, torrent retry count {download.Torrent.RetryCount}/{download.Torrent.TorrentRetryAttempts}", download, download.Torrent);
|
||||
|
||||
if (download.RetryCount < download.Torrent.DownloadRetryAttempts)
|
||||
|
|
@ -613,4 +613,19 @@ public class TorrentRunner
|
|||
|
||||
_logger.LogDebug(message);
|
||||
}
|
||||
|
||||
private void LogError(String message, Download? download, Torrent? torrent)
|
||||
{
|
||||
if (download != null)
|
||||
{
|
||||
message = $"{message} {download.ToLog()}";
|
||||
}
|
||||
|
||||
if (torrent != null)
|
||||
{
|
||||
message = $"{message} {torrent.ToLog()}";
|
||||
}
|
||||
|
||||
_logger.LogError(message);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue