Use asynchronous logging
This commit is contained in:
parent
05282fd167
commit
b4ad1e5041
@ -22,6 +22,7 @@
|
||||
<PackageReference Include="Serilog" Version="2.8.0" />
|
||||
<PackageReference Include="Serilog.Formatting.Compact" Version="1.0.0" />
|
||||
<PackageReference Include="Serilog.NodaTime" Version="1.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.1-dev-00071" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
|
||||
</ItemGroup>
|
||||
|
@ -323,14 +323,16 @@ namespace PluralKit
|
||||
return new LoggerConfiguration()
|
||||
.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb)
|
||||
.MinimumLevel.Debug()
|
||||
.WriteTo.File(
|
||||
new RenderedCompactJsonFormatter(),
|
||||
(config.LogDir ?? "logs") + $"/pluralkit.{component}.log",
|
||||
rollingInterval: RollingInterval.Day,
|
||||
flushToDiskInterval: TimeSpan.FromSeconds(10),
|
||||
restrictedToMinimumLevel: LogEventLevel.Information,
|
||||
buffered: true)
|
||||
.WriteTo.Console(theme: AnsiConsoleTheme.Code, outputTemplate:"[{Timestamp:HH:mm:ss}] [{EventId}] {Level:u3} {Message:lj}{NewLine}{Exception}")
|
||||
.WriteTo.Async(a =>
|
||||
a.File(
|
||||
new RenderedCompactJsonFormatter(),
|
||||
(config.LogDir ?? "logs") + $"/pluralkit.{component}.log",
|
||||
rollingInterval: RollingInterval.Day,
|
||||
flushToDiskInterval: TimeSpan.FromSeconds(10),
|
||||
restrictedToMinimumLevel: LogEventLevel.Information,
|
||||
buffered: true))
|
||||
.WriteTo.Async(a =>
|
||||
a.Console(theme: AnsiConsoleTheme.Code, outputTemplate:"[{Timestamp:HH:mm:ss}] [{EventId}] {Level:u3} {Message:lj}{NewLine}{Exception}"))
|
||||
.CreateLogger();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user