diff --git a/CHANGELOG.md b/CHANGELOG.md index 14941ea0..0d771c70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Default value: `false` - When enabled, embedded text subtitles will be periodically extracted, and considered for playback - Add `sub_language` and `sub_language_tag` fields to search index -- Add `/iptv` request logging to streaming log category at debug level +- Add `/iptv` request logging in its own log category at debug level - Add channel guide (XMLTV) template system - Templates should be copied from `_channel.sbntxt`, `_movie.sbntxt`, `_episode.sbntxt`, or `_musicVideo.sbntxt` which are located in the config subfolder `templates/channel-guide` - Copy the file, remove the leading underscore from the name, and only make edits to the copied file diff --git a/ErsatzTV.Application/Configuration/Commands/UpdateGeneralSettingsHandler.cs b/ErsatzTV.Application/Configuration/Commands/UpdateGeneralSettingsHandler.cs index 8229e50e..96b42fcf 100644 --- a/ErsatzTV.Application/Configuration/Commands/UpdateGeneralSettingsHandler.cs +++ b/ErsatzTV.Application/Configuration/Commands/UpdateGeneralSettingsHandler.cs @@ -35,6 +35,9 @@ public class UpdateGeneralSettingsHandler : IRequestHandler maybeStreamingLevel = await _configElementRepository.GetValue(ConfigElementKey.MinimumLogLevelStreaming); + Option maybeHttpLevel = + await _configElementRepository.GetValue(ConfigElementKey.MinimumLogLevelHttp); + return new GeneralSettingsViewModel { DefaultMinimumLogLevel = await maybeDefaultLevel.IfNoneAsync(LogEventLevel.Information), ScanningMinimumLogLevel = await maybeScanningLevel.IfNoneAsync(LogEventLevel.Information), SchedulingMinimumLogLevel = await maybeSchedulingLevel.IfNoneAsync(LogEventLevel.Information), StreamingMinimumLogLevel = await maybeStreamingLevel.IfNoneAsync(LogEventLevel.Information), + HttpMinimumLogLevel = await maybeHttpLevel.IfNoneAsync(LogEventLevel.Information) }; } } diff --git a/ErsatzTV.Core/Domain/ConfigElementKey.cs b/ErsatzTV.Core/Domain/ConfigElementKey.cs index e1dd9d5c..84daf26c 100644 --- a/ErsatzTV.Core/Domain/ConfigElementKey.cs +++ b/ErsatzTV.Core/Domain/ConfigElementKey.cs @@ -10,6 +10,7 @@ public class ConfigElementKey public static ConfigElementKey MinimumLogLevelScanning => new("log.minimum_level.scanning"); public static ConfigElementKey MinimumLogLevelScheduling => new("log.minimum_level.scheduling"); public static ConfigElementKey MinimumLogLevelStreaming => new("log.minimum_level.streaming"); + public static ConfigElementKey MinimumLogLevelHttp => new("log.minimum_level.http"); public static ConfigElementKey FFmpegPath => new("ffmpeg.ffmpeg_path"); public static ConfigElementKey FFprobePath => new("ffmpeg.ffprobe_path"); public static ConfigElementKey FFmpegDefaultProfileId => new("ffmpeg.default_profile_id"); diff --git a/ErsatzTV.Core/LoggingLevelSwitches.cs b/ErsatzTV.Core/LoggingLevelSwitches.cs index 670215b5..c2696031 100644 --- a/ErsatzTV.Core/LoggingLevelSwitches.cs +++ b/ErsatzTV.Core/LoggingLevelSwitches.cs @@ -11,4 +11,6 @@ public class LoggingLevelSwitches public LoggingLevelSwitch SchedulingLevelSwitch { get; } = new(); public LoggingLevelSwitch StreamingLevelSwitch { get; } = new(); + + public LoggingLevelSwitch HttpLevelSwitch { get; } = new(); } diff --git a/ErsatzTV/Pages/Settings.razor b/ErsatzTV/Pages/Settings.razor index ac2a1288..055d2159 100644 --- a/ErsatzTV/Pages/Settings.razor +++ b/ErsatzTV/Pages/Settings.razor @@ -169,6 +169,15 @@ Warning Error + + Debug + Information + Warning + Error + diff --git a/ErsatzTV/Program.cs b/ErsatzTV/Program.cs index 9f5afebf..7ef3fc03 100644 --- a/ErsatzTV/Program.cs +++ b/ErsatzTV/Program.cs @@ -58,6 +58,7 @@ public class Program LoggingLevelSwitches.ScanningLevelSwitch.MinimumLevel = LogEventLevel.Information; LoggingLevelSwitches.SchedulingLevelSwitch.MinimumLevel = LogEventLevel.Information; LoggingLevelSwitches.StreamingLevelSwitch.MinimumLevel = LogEventLevel.Information; + LoggingLevelSwitches.HttpLevelSwitch.MinimumLevel = LogEventLevel.Information; LoggerConfiguration loggerConfiguration = new LoggerConfiguration() .ReadFrom.Configuration(Configuration) @@ -78,7 +79,9 @@ public class Program .MinimumLevel.Override("ErsatzTV.FFmpeg", LoggingLevelSwitches.StreamingLevelSwitch) .MinimumLevel.Override("ErsatzTV.Core.FFmpeg.FFmpegLibraryProcessService", LoggingLevelSwitches.StreamingLevelSwitch) .MinimumLevel.Override("ErsatzTV.Controllers.IptvController", LoggingLevelSwitches.StreamingLevelSwitch) - .MinimumLevel.Override("Serilog.AspNetCore.RequestLoggingMiddleware", LoggingLevelSwitches.StreamingLevelSwitch) + + // http + .MinimumLevel.Override("Serilog.AspNetCore.RequestLoggingMiddleware", LoggingLevelSwitches.HttpLevelSwitch) .Destructure.UsingAttributes() .Enrich.FromLogContext() diff --git a/ErsatzTV/Services/RunOnce/LoadLoggingLevelService.cs b/ErsatzTV/Services/RunOnce/LoadLoggingLevelService.cs index 674bc28b..c83b2772 100644 --- a/ErsatzTV/Services/RunOnce/LoadLoggingLevelService.cs +++ b/ErsatzTV/Services/RunOnce/LoadLoggingLevelService.cs @@ -54,5 +54,11 @@ public class LoadLoggingLevelService : BackgroundService LoggingLevelSwitches loggingLevelSwitches = scope.ServiceProvider.GetRequiredService(); loggingLevelSwitches.StreamingLevelSwitch.MinimumLevel = logLevel; } + + foreach (LogEventLevel logLevel in await configElementRepository.GetValue(ConfigElementKey.MinimumLogLevelHttp)) + { + LoggingLevelSwitches loggingLevelSwitches = scope.ServiceProvider.GetRequiredService(); + loggingLevelSwitches.HttpLevelSwitch.MinimumLevel = logLevel; + } } }