diff --git a/Catalogger.Backend/Catalogger.Backend.csproj b/Catalogger.Backend/Catalogger.Backend.csproj index baf29b4..73e806a 100644 --- a/Catalogger.Backend/Catalogger.Backend.csproj +++ b/Catalogger.Backend/Catalogger.Backend.csproj @@ -32,6 +32,7 @@ + diff --git a/Catalogger.Backend/Config.cs b/Catalogger.Backend/Config.cs index af27715..499f34a 100644 --- a/Catalogger.Backend/Config.cs +++ b/Catalogger.Backend/Config.cs @@ -16,6 +16,8 @@ public class Config public int MetricsPort { get; init; } = 5001; public bool EnableMetrics { get; init; } = true; + + public string? SeqLogUrl { get; init; } } public class DatabaseConfig diff --git a/Catalogger.Backend/Extensions/StartupExtensions.cs b/Catalogger.Backend/Extensions/StartupExtensions.cs index 1d4b822..0f2a47f 100644 --- a/Catalogger.Backend/Extensions/StartupExtensions.cs +++ b/Catalogger.Backend/Extensions/StartupExtensions.cs @@ -48,6 +48,14 @@ public static class StartupExtensions // The default theme doesn't support light mode .WriteTo.Console(theme: AnsiConsoleTheme.Sixteen); + if (config.Logging.SeqLogUrl != null) + { + logCfg.WriteTo.Seq( + config.Logging.SeqLogUrl, + restrictedToMinimumLevel: LogEventLevel.Verbose + ); + } + // AddSerilog doesn't seem to add an ILogger to the service collection, so add that manually. builder.Services.AddSerilog().AddSingleton(Log.Logger = logCfg.CreateLogger());