separate request logging into its own category (#1601)
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
@@ -35,6 +35,9 @@ public class UpdateGeneralSettingsHandler : IRequestHandler<UpdateGeneralSetting
|
||||
await _configElementRepository.Upsert(ConfigElementKey.MinimumLogLevelStreaming, generalSettings.StreamingMinimumLogLevel);
|
||||
_loggingLevelSwitches.StreamingLevelSwitch.MinimumLevel = generalSettings.StreamingMinimumLogLevel;
|
||||
|
||||
await _configElementRepository.Upsert(ConfigElementKey.MinimumLogLevelHttp, generalSettings.HttpMinimumLogLevel);
|
||||
_loggingLevelSwitches.HttpLevelSwitch.MinimumLevel = generalSettings.HttpMinimumLogLevel;
|
||||
|
||||
return Unit.Default;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,5 @@ public class GeneralSettingsViewModel
|
||||
public LogEventLevel ScanningMinimumLogLevel { get; set; }
|
||||
public LogEventLevel SchedulingMinimumLogLevel { get; set; }
|
||||
public LogEventLevel StreamingMinimumLogLevel { get; set; }
|
||||
public LogEventLevel HttpMinimumLogLevel { get; set; }
|
||||
}
|
||||
|
||||
@@ -25,12 +25,16 @@ public class GetGeneralSettingsHandler : IRequestHandler<GetGeneralSettings, Gen
|
||||
Option<LogEventLevel> maybeStreamingLevel =
|
||||
await _configElementRepository.GetValue<LogEventLevel>(ConfigElementKey.MinimumLogLevelStreaming);
|
||||
|
||||
Option<LogEventLevel> maybeHttpLevel =
|
||||
await _configElementRepository.GetValue<LogEventLevel>(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)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -11,4 +11,6 @@ public class LoggingLevelSwitches
|
||||
public LoggingLevelSwitch SchedulingLevelSwitch { get; } = new();
|
||||
|
||||
public LoggingLevelSwitch StreamingLevelSwitch { get; } = new();
|
||||
|
||||
public LoggingLevelSwitch HttpLevelSwitch { get; } = new();
|
||||
}
|
||||
|
||||
@@ -169,6 +169,15 @@
|
||||
<MudSelectItem Value="@LogEventLevel.Warning">Warning</MudSelectItem>
|
||||
<MudSelectItem Value="@LogEventLevel.Error">Error</MudSelectItem>
|
||||
</MudSelect>
|
||||
<MudSelect Class="mt-3"
|
||||
Label="Request Logging Minimum Log Level"
|
||||
@bind-Value="_generalSettings.HttpMinimumLogLevel"
|
||||
For="@(() => _generalSettings.HttpMinimumLogLevel)">
|
||||
<MudSelectItem Value="@LogEventLevel.Debug">Debug</MudSelectItem>
|
||||
<MudSelectItem Value="@LogEventLevel.Information">Information</MudSelectItem>
|
||||
<MudSelectItem Value="@LogEventLevel.Warning">Warning</MudSelectItem>
|
||||
<MudSelectItem Value="@LogEventLevel.Error">Error</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudForm>
|
||||
</MudCardContent>
|
||||
<MudCardActions>
|
||||
|
||||
+4
-1
@@ -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()
|
||||
|
||||
@@ -54,5 +54,11 @@ public class LoadLoggingLevelService : BackgroundService
|
||||
LoggingLevelSwitches loggingLevelSwitches = scope.ServiceProvider.GetRequiredService<LoggingLevelSwitches>();
|
||||
loggingLevelSwitches.StreamingLevelSwitch.MinimumLevel = logLevel;
|
||||
}
|
||||
|
||||
foreach (LogEventLevel logLevel in await configElementRepository.GetValue<LogEventLevel>(ConfigElementKey.MinimumLogLevelHttp))
|
||||
{
|
||||
LoggingLevelSwitches loggingLevelSwitches = scope.ServiceProvider.GetRequiredService<LoggingLevelSwitches>();
|
||||
loggingLevelSwitches.HttpLevelSwitch.MinimumLevel = logLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user