added trace logs

This commit is contained in:
Flaminel
2025-02-22 01:10:51 +02:00
parent e006521dc9
commit 5bd2a9cbea
2 changed files with 10 additions and 3 deletions
@@ -19,7 +19,7 @@ public sealed class DownloadCleaner : GenericHandler
private readonly DownloadCleanerConfig _config; private readonly DownloadCleanerConfig _config;
private readonly HashSet<string> _excludedHashes = []; private readonly HashSet<string> _excludedHashes = [];
private static bool _hardLinkCategoryCreated = false; private static bool _hardLinkCategoryCreated;
public DownloadCleaner( public DownloadCleaner(
ILogger<DownloadCleaner> logger, ILogger<DownloadCleaner> logger,
@@ -69,10 +69,13 @@ public sealed class DownloadCleaner : GenericHandler
{ {
if (!_hardLinkCategoryCreated) if (!_hardLinkCategoryCreated)
{ {
_logger.LogTrace("creating category {cat}", _config.NoHardlinksCategory);
await _downloadService.CreateCategoryAsync(_config.NoHardlinksCategory); await _downloadService.CreateCategoryAsync(_config.NoHardlinksCategory);
_hardLinkCategoryCreated = true; _hardLinkCategoryCreated = true;
} }
_logger.LogTrace("getting downloads to change category");
downloadsToChangeCategory = await _downloadService.GetDownloadsToChangeCategoryAsync(_config.HardlinkCategories); downloadsToChangeCategory = await _downloadService.GetDownloadsToChangeCategoryAsync(_config.HardlinkCategories);
} }
@@ -94,20 +97,22 @@ public sealed class DownloadCleaner : GenericHandler
if (hasDownloadsToChange) if (hasDownloadsToChange)
{ {
_logger.LogTrace("processing downloads to change category");
await _downloadService.ChangeCategoryForNoHardLinksAsync(downloadsToChangeCategory, _excludedHashes); await _downloadService.ChangeCategoryForNoHardLinksAsync(downloadsToChangeCategory, _excludedHashes);
} }
else else
{ {
_logger.LogDebug("no downloads found to change category"); _logger.LogTrace("no downloads found to change category");
} }
if (hasDownloadsToClean) if (hasDownloadsToClean)
{ {
_logger.LogTrace("processing downloads to be cleaned");
await _downloadService.CleanDownloadsAsync(downloadsToBeCleaned, _config.Categories, _excludedHashes); await _downloadService.CleanDownloadsAsync(downloadsToBeCleaned, _config.Categories, _excludedHashes);
} }
else else
{ {
_logger.LogDebug("no downloads found to be cleaned"); _logger.LogTrace("no downloads found to be cleaned");
} }
} }
@@ -322,6 +322,8 @@ public class QBitService : DownloadService, IQBitService
.ToList() .ToList()
.ForEach(x => .ForEach(x =>
{ {
_logger.LogTrace("populating file counts from {dir}", x);
if (!Directory.Exists(x)) if (!Directory.Exists(x))
{ {
throw new ValidationException($"directory \"{x}\" does not exist"); throw new ValidationException($"directory \"{x}\" does not exist");