mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
Use asynchronous logging
This commit is contained in:
parent
05282fd167
commit
b4ad1e5041
2 changed files with 11 additions and 8 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue