Browse Source

limit console log output on windows (#1212)

pull/1216/head
Jason Dove 2 years ago committed by GitHub
parent
commit
fdab54a055
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      CHANGELOG.md
  2. 24
      ErsatzTV.Application/MediaCollections/Commands/TraktCommandBase.cs
  3. 6
      ErsatzTV.Core/FFmpeg/FFmpegLibraryProcessService.cs
  4. 2
      ErsatzTV.Infrastructure/Plex/PlexServerApiClient.cs
  5. 21
      ErsatzTV/Program.cs
  6. 1
      ErsatzTV/Services/WorkerService.cs
  7. 11
      ErsatzTV/appsettings.Development.json
  8. 11
      ErsatzTV/appsettings.json

3
CHANGELOG.md

@ -34,6 +34,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -34,6 +34,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Emby collection scanning will no longer happen after every (automatic or forced) library scan
- Automatic/periodic scans will check collections one time after all libraries have been scanned
- There is a new table in the `Media` > `Libraries` page with a button to manually re-scan Emby collections as needed
- For performance reasons, limit console log output to errors on Windows
- Other platforms are unchanged
- Log file behavior is unchanged
## [0.7.5-beta] - 2023-03-05
### Added

24
ErsatzTV.Application/MediaCollections/Commands/TraktCommandBase.cs

@ -208,7 +208,7 @@ public abstract class TraktCommandBase @@ -208,7 +208,7 @@ public abstract class TraktCommandBase
foreach (int movieId in maybeMovieByGuid)
{
_logger.LogDebug("Located trakt movie {Title} by id", item.DisplayTitle);
// _logger.LogDebug("Located trakt movie {Title} by id", item.DisplayTitle);
return movieId;
}
@ -221,11 +221,11 @@ public abstract class TraktCommandBase @@ -221,11 +221,11 @@ public abstract class TraktCommandBase
foreach (int movieId in maybeMovieByTitleYear)
{
_logger.LogDebug("Located trakt movie {Title} by title/year", item.DisplayTitle);
// _logger.LogDebug("Located trakt movie {Title} by title/year", item.DisplayTitle);
return movieId;
}
_logger.LogDebug("Unable to locate trakt movie {Title}", item.DisplayTitle);
// _logger.LogDebug("Unable to locate trakt movie {Title}", item.DisplayTitle);
return None;
}
@ -243,7 +243,7 @@ public abstract class TraktCommandBase @@ -243,7 +243,7 @@ public abstract class TraktCommandBase
foreach (int showId in maybeShowByGuid)
{
_logger.LogDebug("Located trakt show {Title} by id", item.DisplayTitle);
// _logger.LogDebug("Located trakt show {Title} by id", item.DisplayTitle);
return showId;
}
@ -256,11 +256,11 @@ public abstract class TraktCommandBase @@ -256,11 +256,11 @@ public abstract class TraktCommandBase
foreach (int showId in maybeShowByTitleYear)
{
_logger.LogDebug("Located trakt show {Title} by title/year", item.Title);
// _logger.LogDebug("Located trakt show {Title} by title/year", item.Title);
return showId;
}
_logger.LogDebug("Unable to locate trakt show {Title}", item.DisplayTitle);
// _logger.LogDebug("Unable to locate trakt show {Title}", item.DisplayTitle);
return None;
}
@ -278,7 +278,7 @@ public abstract class TraktCommandBase @@ -278,7 +278,7 @@ public abstract class TraktCommandBase
foreach (int seasonId in maybeSeasonByGuid)
{
_logger.LogDebug("Located trakt season {Title} by id", item.DisplayTitle);
// _logger.LogDebug("Located trakt season {Title} by id", item.DisplayTitle);
return seasonId;
}
@ -292,11 +292,11 @@ public abstract class TraktCommandBase @@ -292,11 +292,11 @@ public abstract class TraktCommandBase
foreach (int seasonId in maybeSeasonByTitleYear)
{
_logger.LogDebug("Located trakt season {Title} by title/year/season", item.DisplayTitle);
// _logger.LogDebug("Located trakt season {Title} by title/year/season", item.DisplayTitle);
return seasonId;
}
_logger.LogDebug("Unable to locate trakt season {Title}", item.DisplayTitle);
// _logger.LogDebug("Unable to locate trakt season {Title}", item.DisplayTitle);
return None;
}
@ -314,7 +314,7 @@ public abstract class TraktCommandBase @@ -314,7 +314,7 @@ public abstract class TraktCommandBase
foreach (int episodeId in maybeEpisodeByGuid)
{
_logger.LogDebug("Located trakt episode {Title} by id", item.DisplayTitle);
// _logger.LogDebug("Located trakt episode {Title} by id", item.DisplayTitle);
return episodeId;
}
@ -329,11 +329,11 @@ public abstract class TraktCommandBase @@ -329,11 +329,11 @@ public abstract class TraktCommandBase
foreach (int episodeId in maybeEpisodeByTitleYear)
{
_logger.LogDebug("Located trakt episode {Title} by title/year/season/episode", item.DisplayTitle);
// _logger.LogDebug("Located trakt episode {Title} by title/year/season/episode", item.DisplayTitle);
return episodeId;
}
_logger.LogDebug("Unable to locate trakt episode {Title}", item.DisplayTitle);
// _logger.LogDebug("Unable to locate trakt episode {Title}", item.DisplayTitle);
return None;
}

6
ErsatzTV.Core/FFmpeg/FFmpegLibraryProcessService.cs

@ -149,8 +149,10 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService @@ -149,8 +149,10 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService
videoPath == audioPath ? playbackSettings.AudioDuration : Option<TimeSpan>.None,
playbackSettings.NormalizeLoudness);
// don't log generated images which are expected to have unknown format
ILogger<FFmpegLibraryProcessService> pixelFormatLogger = videoPath == audioPath ? _logger : null;
// don't log generated images, or hls direct, which are expected to have unknown format
bool isUnknownPixelFormatExpected =
videoPath != audioPath || channel.StreamingMode == StreamingMode.HttpLiveStreamingDirect;
ILogger<FFmpegLibraryProcessService> pixelFormatLogger = isUnknownPixelFormatExpected ? null : _logger;
IPixelFormat pixelFormat = await AvailablePixelFormats.ForPixelFormat(videoStream.PixelFormat, pixelFormatLogger)
.IfNoneAsync(

2
ErsatzTV.Infrastructure/Plex/PlexServerApiClient.cs

@ -994,7 +994,7 @@ public class PlexServerApiClient : IPlexServerApiClient @@ -994,7 +994,7 @@ public class PlexServerApiClient : IPlexServerApiClient
if (guid.StartsWith("local://"))
{
_logger.LogDebug("Ignoring local Plex guid: {Guid}", guid);
// _logger.LogDebug("Ignoring local Plex guid: {Guid}", guid);
}
else
{

21
ErsatzTV/Program.cs

@ -1,8 +1,10 @@ @@ -1,8 +1,10 @@
using System.Runtime.InteropServices;
using Destructurama;
using ErsatzTV.Core;
using Serilog;
using Serilog.Core;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;
namespace ErsatzTV;
@ -42,13 +44,26 @@ public class Program @@ -42,13 +44,26 @@ public class Program
{
LoggingLevelSwitch.MinimumLevel = LogEventLevel.Information;
Log.Logger = new LoggerConfiguration()
LoggerConfiguration loggerConfiguration = new LoggerConfiguration()
.ReadFrom.Configuration(Configuration)
.MinimumLevel.ControlledBy(LoggingLevelSwitch)
.Destructure.UsingAttributes()
.Enrich.FromLogContext()
.WriteTo.File(FileSystemLayout.LogFilePath, rollingInterval: RollingInterval.Day)
.CreateLogger();
.WriteTo.File(FileSystemLayout.LogFilePath, rollingInterval: RollingInterval.Day);
// for performance reasons, restrict windows console to error logs
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
loggerConfiguration = loggerConfiguration.WriteTo.Console(
restrictedToMinimumLevel: LogEventLevel.Error,
theme: AnsiConsoleTheme.Code);
}
else
{
loggerConfiguration = loggerConfiguration.WriteTo.Console(theme: AnsiConsoleTheme.Code);
}
Log.Logger = loggerConfiguration.CreateLogger();
try
{

1
ErsatzTV/Services/WorkerService.cs

@ -59,7 +59,6 @@ public class WorkerService : BackgroundService @@ -59,7 +59,6 @@ public class WorkerService : BackgroundService
error.Value));
break;
case DeleteOrphanedArtwork deleteOrphanedArtwork:
_logger.LogInformation("Deleting orphaned artwork from the database");
await mediator.Send(deleteOrphanedArtwork, cancellationToken);
break;
case AddTraktList addTraktList:

11
ErsatzTV/appsettings.Development.json

@ -1,19 +1,8 @@ @@ -1,19 +1,8 @@
{
"Serilog": {
"Using": [
"Serilog.Sinks.Console"
],
"MinimumLevel": {
"Default": "Debug"
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console"
}
}
],
"Enrich": [
"FromLogContext",
"WithMachineName",

11
ErsatzTV/appsettings.json

@ -1,8 +1,5 @@ @@ -1,8 +1,5 @@
{
"Serilog": {
"Using": [
"Serilog.Sinks.Console"
],
"MinimumLevel": {
"Default": "Information",
"Override": {
@ -11,14 +8,6 @@ @@ -11,14 +8,6 @@
"System.Net.Http.HttpClient": "Warning"
}
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console"
}
}
],
"Enrich": [
"FromLogContext",
"WithMachineName",

Loading…
Cancel
Save