From 0b5d0b7c4e16098b9780a9c6753585c4f95f4f64 Mon Sep 17 00:00:00 2001 From: TheUbMunster Date: Sat, 24 Dec 2022 20:29:19 -0700 Subject: [PATCH] enable/disable the filtering of non-warning log messages --- Server/DiscordBot.cs | 13 ++++++++----- Server/Settings.cs | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Server/DiscordBot.cs b/Server/DiscordBot.cs index 327ef14..b4da11c 100644 --- a/Server/DiscordBot.cs +++ b/Server/DiscordBot.cs @@ -72,13 +72,16 @@ public class DiscordBot { //as time goes on, we may encounter logged info that we literally don't care about. Fill out an if statement to properly //filter it out to avoid logging it to discord. - if (a.Message.Contains("Server requested a reconnect")) + if (localSettings.FilterOutNonIssueWarnings) { - //This is to filter out this message. This warning is for discord server load balancing and isn't a problem + if (a.Message.Contains("Server requested a reconnect")) + { + //This is to filter out this message. This warning is for discord server load balancing and isn't a problem - //Warning[Discord: Gateway] Discord.WebSocket.GatewayReconnectException: Server requested a reconnect - //Warning[Discord: Gateway] at Discord.ConnectionManager.<> c__DisplayClass29_0.<< StartAsync > b__0 > d.MoveNext() - return; + //Warning[Discord: Gateway] Discord.WebSocket.GatewayReconnectException: Server requested a reconnect + //Warning[Discord: Gateway] at Discord.ConnectionManager.<> c__DisplayClass29_0.<< StartAsync > b__0 > d.MoveNext() + return; + } } string message = a.Message + (a.Exception != null ? "Exception: " + a.Exception.ToString() : ""); ConsoleColor col; diff --git a/Server/Settings.cs b/Server/Settings.cs index 859624f..2228dbc 100644 --- a/Server/Settings.cs +++ b/Server/Settings.cs @@ -77,6 +77,7 @@ public class Settings { [JsonProperty(PropertyName = "LogChannel")] public string? AdminChannel { get; set; } public bool LogCommands { get; set; } = false; + public bool FilterOutNonIssueWarnings { get; set; } = true; } public class ShineTable {