From 9bddc59fe25592e87460d913b68426aaa4463cce Mon Sep 17 00:00:00 2001 From: Thomas Gander Date: Sun, 25 Jan 2026 09:11:45 -0700 Subject: [PATCH] Further improvement to logging formatting and readability --- .../Helpers/MovieHelper.cs | 3 +- .../ScheduledTasks/StaleMediaTask.cs | 35 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Jellyfin.Plugin.MediaCleaner/Helpers/MovieHelper.cs b/Jellyfin.Plugin.MediaCleaner/Helpers/MovieHelper.cs index 7621892..86a9c06 100644 --- a/Jellyfin.Plugin.MediaCleaner/Helpers/MovieHelper.cs +++ b/Jellyfin.Plugin.MediaCleaner/Helpers/MovieHelper.cs @@ -19,7 +19,8 @@ public class MovieHelper(ILogger logger) { ArgumentNullException.ThrowIfNull(movie, "IsMovieStale process recieved a null movie. Logic failure. Exception thrown."); - _loggingHelper.LogDebugInformation("Start of scanning for movie: {Movie}", movie); + _loggingHelper.LogDebugInformation("-------------------------------------------------"); + _loggingHelper.LogDebugInformation("Scanning movie: {Movie}", movie); _loggingHelper.LogDebugInformation("-------------------------------------------------"); bool movieIsStale = false; diff --git a/Jellyfin.Plugin.MediaCleaner/ScheduledTasks/StaleMediaTask.cs b/Jellyfin.Plugin.MediaCleaner/ScheduledTasks/StaleMediaTask.cs index 8400349..d7dfb28 100644 --- a/Jellyfin.Plugin.MediaCleaner/ScheduledTasks/StaleMediaTask.cs +++ b/Jellyfin.Plugin.MediaCleaner/ScheduledTasks/StaleMediaTask.cs @@ -81,30 +81,19 @@ public sealed class StaleMediaTask : IScheduledTask _loggingHelper.LogInformation("-------------------------------------------------"); _loggingHelper.LogInformation("Starting scan of series items."); - _loggingHelper.LogInformation("-------------------------------------------------"); List staleSeasons = [.. series.SelectMany(GetStaleSeasons)]; _loggingHelper.LogInformation("-------------------------------------------------"); - _loggingHelper.LogInformation("Starting scan of movies items."); + _loggingHelper.LogInformation("End of scan for series items."); + _loggingHelper.LogInformation("-------------------------------------------------"); + _loggingHelper.LogInformation("Starting scan of movie items."); List staleMovies = [.. GetStaleMovies(movies)]; _loggingHelper.LogInformation("-------------------------------------------------"); - _loggingHelper.LogInformation("Stale Movies found: {StaleMovies}", staleMovies.Count); - - if (staleMovies.Count > 0) - { - foreach (var movieInfo in staleMovies) - { - _loggingHelper.LogInformation("Movie Info: ID: {Id} | Movie Name: {MovieName}", [movieInfo.Id, movieInfo.Name]); - } - } - else - { - _loggingHelper.LogInformation("No stale movies found!"); - } + _loggingHelper.LogInformation("End of scan for movie items."); _loggingHelper.LogInformation("-------------------------------------------------"); _loggingHelper.LogInformation("Stale seasons found: {StaleSeasons}", staleSeasons.Count); @@ -123,6 +112,21 @@ public sealed class StaleMediaTask : IScheduledTask _loggingHelper.LogInformation("No stale seasons found!"); } + _loggingHelper.LogInformation("-------------------------------------------------"); + _loggingHelper.LogInformation("Stale Movies found: {StaleMovies}", staleMovies.Count); + + if (staleMovies.Count > 0) + { + foreach (var movieInfo in staleMovies) + { + _loggingHelper.LogInformation("Movie Info: ID: {Id} | Movie Name: {MovieName}", [movieInfo.Id, movieInfo.Name]); + } + } + else + { + _loggingHelper.LogInformation("No stale movies found!"); + } + _loggingHelper.LogInformation("-------------------------------------------------"); _loggingHelper.LogInformation("Ending stale media scan..."); _loggingHelper.LogInformation("-------------------------------------------------"); @@ -150,6 +154,7 @@ public sealed class StaleMediaTask : IScheduledTask private List GetStaleSeasons(BaseItem item) { + _loggingHelper.LogDebugInformation("-------------------------------------------------"); _loggingHelper.LogDebugInformation("Debug data for series: {SeriesName}", item.Name); _loggingHelper.LogDebugInformation("-------------------------------------------------");