From 94aba8e17c29c1762269a08cc7c6d19ac1f518c3 Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Sat, 5 Aug 2023 12:26:26 +0500 Subject: [PATCH] Logger fixes Signed-off-by: Octol1ttle --- src/Commands/Events/ErrorLoggingPostExecutionEvent.cs | 4 ++-- src/Extensions.cs | 2 +- src/Services/Update/MemberUpdateService.cs | 2 +- src/Services/Update/ScheduledEventUpdateService.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Commands/Events/ErrorLoggingPostExecutionEvent.cs b/src/Commands/Events/ErrorLoggingPostExecutionEvent.cs index bc8031b..b0fbccf 100644 --- a/src/Commands/Events/ErrorLoggingPostExecutionEvent.cs +++ b/src/Commands/Events/ErrorLoggingPostExecutionEvent.cs @@ -23,14 +23,14 @@ public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent /// Logs a warning using the injected if the has not /// succeeded. /// - /// The context of the slash command. Unused. + /// The context of the slash command. /// The result whose success is checked. /// The cancellation token for this operation. Unused. /// A result which has succeeded. public Task AfterExecutionAsync( ICommandContext context, IResult commandResult, CancellationToken ct = default) { - _logger.LogResult(commandResult, "Error in slash command execution."); + _logger.LogResult(commandResult, $"Error in slash command execution for /{context.Command.Command.Node.Key}."); return Task.FromResult(Result.FromSuccess()); } diff --git a/src/Extensions.cs b/src/Extensions.cs index 6ce60fb..9a05e80 100644 --- a/src/Extensions.cs +++ b/src/Extensions.cs @@ -280,7 +280,7 @@ public static class Extensions if (result.Error is ExceptionError exe) { - logger.LogError(exe.Exception, "{UserMessage}\n{ResultErrorMessage}", message, result.Error.Message); + logger.LogError(exe.Exception, "{ErrorMessage}", message); return; } diff --git a/src/Services/Update/MemberUpdateService.cs b/src/Services/Update/MemberUpdateService.cs index 00a5625..493326f 100644 --- a/src/Services/Update/MemberUpdateService.cs +++ b/src/Services/Update/MemberUpdateService.cs @@ -50,7 +50,7 @@ public sealed partial class MemberUpdateService : BackgroundService tasks.AddRange(guildIds.Select(async id => { var tickResult = await TickMemberDatasAsync(id, ct); - _logger.LogResult(tickResult); + _logger.LogResult(tickResult, $"Error in member data update for guild {id}."); })); await Task.WhenAll(tasks); diff --git a/src/Services/Update/ScheduledEventUpdateService.cs b/src/Services/Update/ScheduledEventUpdateService.cs index 87bec88..3ac8358 100644 --- a/src/Services/Update/ScheduledEventUpdateService.cs +++ b/src/Services/Update/ScheduledEventUpdateService.cs @@ -46,7 +46,7 @@ public sealed class ScheduledEventUpdateService : BackgroundService tasks.AddRange(guildIds.Select(async id => { var tickResult = await TickScheduledEventsAsync(id, ct); - _logger.LogResult(tickResult); + _logger.LogResult(tickResult, $"Error in scheduled events update for guild {id}."); })); await Task.WhenAll(tasks);