Add exception logging for dropped connections

This commit is contained in:
Ske 2019-12-22 12:08:52 +01:00
parent 6a55555e48
commit 93a52ff95a

View File

@ -150,6 +150,7 @@ namespace PluralKit.Bot
public Task Init() public Task Init()
{ {
_client.ShardDisconnected += ShardDisconnected;
_client.ShardReady += ShardReady; _client.ShardReady += ShardReady;
_client.Log += FrameworkLog; _client.Log += FrameworkLog;
@ -164,6 +165,12 @@ namespace PluralKit.Bot
return Task.CompletedTask; return Task.CompletedTask;
} }
private Task ShardDisconnected(Exception ex, DiscordSocketClient shard)
{
_logger.Warning(ex, $"Shard #{shard.ShardId} disconnected");
return Task.CompletedTask;
}
private Task FrameworkLog(LogMessage msg) private Task FrameworkLog(LogMessage msg)
{ {
// Bridge D.NET logging to Serilog // Bridge D.NET logging to Serilog