fix: better logging
- verbose logging for log channel resolving logic - don't LOG TOKENS TO THE CONSOLE OR SEQ - actually log verbose logs to seq - report open db connections to prometheus
This commit is contained in:
parent
7749c9d9e2
commit
5157105c35
7 changed files with 109 additions and 50 deletions
|
|
@ -51,19 +51,22 @@ public static class StartupExtensions
|
|||
{
|
||||
var logCfg = new LoggerConfiguration()
|
||||
.Enrich.FromLogContext()
|
||||
.MinimumLevel.Is(config.Logging.LogEventLevel)
|
||||
.MinimumLevel.Verbose()
|
||||
// Most Microsoft.* package logs are needlessly verbose, so we restrict them to INFO level and up
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
|
||||
// ASP.NET's built in request logs are extremely verbose, so we use Serilog's instead.
|
||||
// Serilog doesn't disable the built-in logs, so we do it here.
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
|
||||
.MinimumLevel.Override(
|
||||
"Microsoft.EntityFrameworkCore.Database.Command",
|
||||
config.Logging.LogQueries ? LogEventLevel.Information : LogEventLevel.Fatal
|
||||
)
|
||||
.MinimumLevel.Override("Microsoft.AspNetCore.Hosting", LogEventLevel.Warning)
|
||||
.MinimumLevel.Override("Microsoft.AspNetCore.Mvc", LogEventLevel.Warning)
|
||||
.MinimumLevel.Override("Microsoft.AspNetCore.Routing", LogEventLevel.Warning)
|
||||
// Let's not put webhook tokens and even *full bot tokens* in the logs, thank you
|
||||
.MinimumLevel.Override("System.Net.Http.HttpClient", LogEventLevel.Warning)
|
||||
// The default theme doesn't support light mode
|
||||
.WriteTo.Console(theme: AnsiConsoleTheme.Sixteen, applyThemeToRedirectedOutput: true);
|
||||
.WriteTo.Console(
|
||||
theme: AnsiConsoleTheme.Sixteen,
|
||||
applyThemeToRedirectedOutput: true,
|
||||
restrictedToMinimumLevel: config.Logging.LogEventLevel
|
||||
);
|
||||
|
||||
if (config.Logging.SeqLogUrl != null)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue