Continued to improve logging and fixed a few bugs introduced by refactor

This commit is contained in:
2026-01-24 23:14:16 -07:00
parent 9e324f14a7
commit 4fc8b4799d
4 changed files with 37 additions and 42 deletions

View File

@@ -17,7 +17,6 @@ public class MovieHelper(ILogger logger)
public bool IsMovieStale(BaseItem movie)
{
_loggingHelper.LogDebugInformation("-------------------------------------------------");
_loggingHelper.LogDebugInformation("Start of scanning for movie: {Movie}", movie);
_loggingHelper.LogDebugInformation("-------------------------------------------------");
@@ -41,19 +40,22 @@ public class MovieHelper(ILogger logger)
if (mostRecentUserData.LastPlayedDate < DateTime.Now.AddDays(-Configuration.StaleMediaCutoff))
{
_loggingHelper.LogDebugInformation("Most recent user data last played date is outside of cutoff. Adding {Movie} to stale movies.", movie);
_loggingHelper.LogDebugInformation("Most recent user data has last played date that is outside of cutoff.");
_loggingHelper.LogDebugInformation("Adding {Movie} to stale movies.", movie);
_loggingHelper.LogDebugInformation("With Last Played Date: {LastPlayedDate}", mostRecentUserData.LastPlayedDate);
movieIsStale = true;
}
}
else if (createdOutsideCutoff)
{
_loggingHelper.LogDebugInformation("Movie has no user data and was created outside of cutoff: {DateCreated}. Adding {Movie} to stale movies.", [movie.DateCreated, movie]);
_loggingHelper.LogDebugInformation("Movie has no user data and was created outside of cutoff: {DateCreated}.", movie.DateCreated);
_loggingHelper.LogDebugInformation("Adding {Movie} to stale movies.", movie);
movieIsStale = true;
}
_loggingHelper.LogDebugInformation("-------------------------------------------------");
_loggingHelper.LogDebugInformation("End of scanning for movie: {Movie}", movie);
_loggingHelper.LogDebugInformation("-------------------------------------------------");
return movieIsStale;
}

View File

@@ -28,8 +28,13 @@ public class SeriesHelper(ILogger logger)
var staleCreationDate = episode.DateCreated < DateTime.Now.AddDays(-Configuration.StaleMediaCutoff);
var hasUserDataWithLastPlayedDate = episode.UserData.Any(data => data.LastPlayedDate != null);
_loggingHelper.LogDebugInformation("-------------------------------------------------");
_loggingHelper.LogDebugInformation("Debug data for episode: {Episode}", episode);
_loggingHelper.LogDebugInformation("-------------------------------------------------");
if (staleCreationDate && !hasUserDataWithLastPlayedDate){
_loggingHelper.LogInformation("Creation date is stale, and no user data for episode {Episode}.", episode);
_loggingHelper.LogDebugInformation("Creation date is stale, and no user data for episode {Episode}.", episode);
_loggingHelper.LogDebugInformation("Date created: {DateCreated}", episode.DateCreated);
episodeIsStale = true;
}
@@ -38,9 +43,6 @@ public class SeriesHelper(ILogger logger)
.OrderByDescending(data => data.LastPlayedDate)
.First();
_loggingHelper.LogDebugInformation("User data for episode: {Episode}", episode);
_loggingHelper.LogDebugInformation("-------------------------------------------------");
foreach (var property in typeof(UserData).GetProperties())
{
_loggingHelper.LogDebugInformation("{PropertyName}: {PropertyValue}", property.Name, property.GetValue(mostRecentUserData));
@@ -54,7 +56,7 @@ public class SeriesHelper(ILogger logger)
{
episodeIsStale = true;
_loggingHelper.LogDebugInformation("Most recent user data has a last played date of: {LastPlayedDate}.", [mostRecentUserData.LastPlayedDate]);
_loggingHelper.LogDebugInformation("And episode created {DateCreated}.", episode.DateCreated);
_loggingHelper.LogDebugInformation("Episode created {DateCreated}.", episode.DateCreated);
_loggingHelper.LogDebugInformation("Episode is marked as stale.");
}
}
@@ -79,6 +81,8 @@ public class SeriesHelper(ILogger logger)
if(staleEpisodes.Count == episodes.Count)
{
seasonIsStale = true;
_loggingHelper.LogDebugInformation("-------------------------------------------------");
_loggingHelper.LogDebugInformation("Stale episodes count matches season episode count. Season is stale.");
_loggingHelper.LogDebugInformation("-------------------------------------------------");
}