diff --git a/Events/ErrorEvents.cs b/Events/ErrorEvents.cs index 01425c9..6ff8c5e 100644 --- a/Events/ErrorEvents.cs +++ b/Events/ErrorEvents.cs @@ -155,8 +155,8 @@ await e.Context.RespondAsync( }; embed.AddField("Message", ex.Message); - Console.WriteLine( - $"{ex.GetType()} occurred when {UserInfoHelpers.GetFullUsername(e.Context.User)} used {e.Command!.QualifiedName}: {ex.Message}\n{ex.StackTrace}"); + Program.Discord.Logger.LogError(Program.BotEventId, "An exception occurred when processing a CommandsNext command!" + + "\n{exType} occurred when {username} used {commandName}: {exMessage}\n{exStackTrace}", ex.GetType(), UserInfoHelpers.GetFullUsername(e.Context.User), e.Command!.QualifiedName, ex.Message, ex.StackTrace); // System.ArgumentException if (ex.GetType().ToString() == "System.ArgumentException") diff --git a/Events/MessageEvents.cs b/Events/MessageEvents.cs index 2abbb28..89d830d 100644 --- a/Events/MessageEvents.cs +++ b/Events/MessageEvents.cs @@ -352,8 +352,8 @@ public static async Task ThrowMessageException(Exception ex, DiscordMessage mess }; embed.AddField("Message", $"{ex.Message}"); - Console.WriteLine( - $"{ex.GetType()} occurred when processing a message {(isEdit ? "edit" : "create")} event: {ex.Message}\n{ex.StackTrace}"); + Program.Discord.Logger.LogError(Program.BotEventId, "An exception occurred when processing a message {eventType} event!" + + "\n{exType}: {exMessage}\n{exStackTrace}", isEdit ? "edit" : "create", ex.GetType(), ex.Message, ex.StackTrace); await Program.HomeChannel.SendMessageAsync(embed); } diff --git a/Helpers/ReminderHelpers.cs b/Helpers/ReminderHelpers.cs index 15494ae..0482e34 100644 --- a/Helpers/ReminderHelpers.cs +++ b/Helpers/ReminderHelpers.cs @@ -14,8 +14,8 @@ public static async Task LogReminderErrorAsync(DiscordChannel logChannel, Except errorEmbed.AddField("Message", $"{ex.Message}"); errorEmbed.AddField("Stack Trace", $"```\n{ex.StackTrace}\n```"); - Console.WriteLine( - $"{ex.GetType()} occurred when checking reminders: {ex.Message}\n{ex.StackTrace}"); + Program.Discord.Logger.LogError(Program.BotEventId, "An exception occurred when checking reminders!" + + "\n{exType}: {exMessage}\n{exStackTrace}", ex.GetType(), ex.Message, ex.StackTrace); await logChannel.SendMessageAsync(errorEmbed); } diff --git a/Tasks/ActivityTasks.cs b/Tasks/ActivityTasks.cs index 92abacd..6055d96 100644 --- a/Tasks/ActivityTasks.cs +++ b/Tasks/ActivityTasks.cs @@ -180,8 +180,8 @@ await Program.Db.StringSetAsync("customStatusLastUpdated", }; embed.AddField("Message", ex.Message); - Console.WriteLine( - $"{ex.GetType()} occurred while processing a custom status message: {ex.Message}\n{ex.StackTrace}"); + Program.Discord.Logger.LogError(Program.BotEventId, "An exception occurred when processing a custom status message!" + + "\n{exType}: {exMessage}\n{exStackTrace}", ex.GetType(), ex.Message, ex.StackTrace); await Program.HomeChannel.SendMessageAsync(embed); }