mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-01 11:39:55 +03:00
Add logging to file (#75)
This PR adds the package `Serilog.Extensions.Logging.File` to add
logging to file. I decided this was necessary after the bot unexpectedly
went down in a tmux session, leaving no traces behind.

---------
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
940f2e64a0
commit
4cb39a34b5
2 changed files with 6 additions and 0 deletions
|
@ -18,6 +18,7 @@ using Remora.Discord.Gateway.Extensions;
|
|||
using Remora.Discord.Hosting.Extensions;
|
||||
using Remora.Discord.Interactivity.Extensions;
|
||||
using Remora.Rest.Core;
|
||||
using Serilog.Extensions.Logging;
|
||||
|
||||
namespace Boyfriend;
|
||||
|
||||
|
@ -95,8 +96,12 @@ public class Boyfriend {
|
|||
}
|
||||
).ConfigureLogging(
|
||||
c => c.AddConsole()
|
||||
.AddFile("Logs/Boyfriend-{Date}.log",
|
||||
outputTemplate: "{Timestamp:o} [{Level:u4}] {Message} {NewLine}{Exception}")
|
||||
.AddFilter("System.Net.Http.HttpClient.*.LogicalHandler", LogLevel.Warning)
|
||||
.AddFilter("System.Net.Http.HttpClient.*.ClientHandler", LogLevel.Warning)
|
||||
.AddFilter<SerilogLoggerProvider>("System.Net.Http.HttpClient.*.LogicalHandler", LogLevel.Warning)
|
||||
.AddFilter<SerilogLoggerProvider>("System.Net.Http.HttpClient.*.ClientHandler", LogLevel.Warning)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue