36 lines
1.3 KiB
C#
36 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Runtime.CompilerServices;
|
|
using Jellyfin.Plugin.MediaCleaner.Configuration;
|
|
using Jellyfin.Plugin.MediaCleaner.Models;
|
|
using Jellyfin.Plugin.MediaCleaner.ScheduledTasks;
|
|
using MediaBrowser.Controller.Entities;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Jellyfin.Plugin.MediaCleaner.Helpers;
|
|
|
|
public class LoggingHelper(ILogger logger)
|
|
{
|
|
private readonly ILogger _logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
|
|
|
[SuppressMessage("Microsoft.Performance", "CA2254:TemplateShouldBeConstant", Justification = "Message parameter is intentionally variable for flexible debug logging")]
|
|
public void LogDebugInformation(string message, params object?[] args)
|
|
{
|
|
if (Configuration.DebugMode)
|
|
{
|
|
_logger.LogInformation(message, args);
|
|
}
|
|
}
|
|
|
|
[SuppressMessage("Microsoft.Performance", "CA2254:TemplateShouldBeConstant", Justification = "Message parameter is intentionally variable for flexible logging")]
|
|
public void LogInformation(string message, params object?[] args)
|
|
{
|
|
_logger.LogInformation(message, args);
|
|
}
|
|
|
|
private static PluginConfiguration Configuration =>
|
|
Plugin.Instance!.Configuration;
|
|
}
|