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