From baa0117e1e781f1ed99add5c12250906402a7ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4felfinger?= Date: Mon, 11 Sep 2023 23:08:40 +0200 Subject: [PATCH] configures serilog retained file count --- PiwigoDirectorySync/Program.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/PiwigoDirectorySync/Program.cs b/PiwigoDirectorySync/Program.cs index e98111f..e73c805 100644 --- a/PiwigoDirectorySync/Program.cs +++ b/PiwigoDirectorySync/Program.cs @@ -14,14 +14,13 @@ using Spectre.Console.Cli; const string outputTemplateConsole = "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}: {Message}{NewLine}"; const string outputTemplateFile = "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message}{NewLine}{NewLine}{Exception}{NewLine}"; -Log.Logger = new LoggerConfiguration() - .MinimumLevel.Debug() +Log.Logger = new LoggerConfiguration().MinimumLevel.Debug() .MinimumLevel.Override("Microsoft", LogEventLevel.Warning) .MinimumLevel.Override("System", LogEventLevel.Warning) .MinimumLevel.Override("Piwigo.Client", LogEventLevel.Warning) .Enrich.FromLogContext() .WriteTo.Console(LogEventLevel.Information, outputTemplateConsole, theme: AnsiConsoleTheme.Code) - .WriteTo.File("logs/PiwigoDirectorySync.txt", LogEventLevel.Debug, outputTemplate:outputTemplateFile, rollingInterval: RollingInterval.Day) + .WriteTo.File("logs/PiwigoDirectorySync.txt", LogEventLevel.Debug, outputTemplateFile, rollingInterval: RollingInterval.Day, retainedFileCountLimit: 90) .CreateLogger(); var registrations = new ServiceCollection();