fix: use a serilog theme that actually works on light mode. why is this not the default

This commit is contained in:
sam 2024-10-09 17:29:20 +02:00
parent 6e51eb1e1e
commit b5e34d517a

View file

@ -18,6 +18,7 @@ using Remora.Discord.Interactivity.Services;
using Remora.Rest.Core; using Remora.Rest.Core;
using Serilog; using Serilog;
using Serilog.Events; using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;
namespace Catalogger.Backend.Extensions; namespace Catalogger.Backend.Extensions;
@ -39,7 +40,8 @@ public static class StartupExtensions
.MinimumLevel.Override("Microsoft.AspNetCore.Hosting", LogEventLevel.Warning) .MinimumLevel.Override("Microsoft.AspNetCore.Hosting", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.AspNetCore.Mvc", LogEventLevel.Warning) .MinimumLevel.Override("Microsoft.AspNetCore.Mvc", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.AspNetCore.Routing", LogEventLevel.Warning) .MinimumLevel.Override("Microsoft.AspNetCore.Routing", LogEventLevel.Warning)
.WriteTo.Console(); // The default theme doesn't support light mode
.WriteTo.Console(theme: AnsiConsoleTheme.Sixteen);
// AddSerilog doesn't seem to add an ILogger to the service collection, so add that manually. // AddSerilog doesn't seem to add an ILogger to the service collection, so add that manually.
builder.Services.AddSerilog().AddSingleton(Log.Logger = logCfg.CreateLogger()); builder.Services.AddSerilog().AddSingleton(Log.Logger = logCfg.CreateLogger());