Update logging filters

This commit is contained in:
Noi 2021-11-17 18:07:28 -08:00
parent ad756ae83b
commit 88bdf8103e

View file

@ -120,19 +120,17 @@ internal class WorldTime : IDisposable {
private Task DiscordClient_Log(LogMessage arg) { private Task DiscordClient_Log(LogMessage arg) {
// Suppress certain messages // Suppress certain messages
if (arg.Message != null) { if (arg.Message != null) {
//switch (arg.Message) switch (arg.Message) {
//{ case "Connecting":
// case "Connecting": case "Connected":
// case "Connected": case "Ready":
// case "Ready":
// case "Failed to resume previous session": // case "Failed to resume previous session":
// case "Resumed previous session": // case "Resumed previous session":
// case "Disconnecting": case "Disconnecting":
// case "Disconnected": case "Disconnected":
// case "WebSocket connection was closed": // case "WebSocket connection was closed":
// case "Server requested a reconnect": return Task.CompletedTask;
// return Task.CompletedTask; }
//}
if (arg.Message == "Heartbeat Errored") { if (arg.Message == "Heartbeat Errored") {
// Replace this with a custom message; do not show stack trace // Replace this with a custom message; do not show stack trace
Program.Log("Discord.Net", $"{arg.Severity}: {arg.Message} - {arg.Exception.Message}"); Program.Log("Discord.Net", $"{arg.Severity}: {arg.Message} - {arg.Exception.Message}");
@ -142,7 +140,11 @@ internal class WorldTime : IDisposable {
Program.Log("Discord.Net", $"{arg.Severity}: {arg.Message}"); Program.Log("Discord.Net", $"{arg.Severity}: {arg.Message}");
} }
if (arg.Exception != null) Program.Log("Discord.Net exception", arg.Exception.ToString()); // Suppress certain exceptions
if (arg.Exception != null) {
if (arg.Exception is not GatewayReconnectException)
Program.Log("Discord.Net exception", arg.Exception.ToString());
}
return Task.CompletedTask; return Task.CompletedTask;
} }