diff --git a/src/Nocr.TelegramClient.AppServices/Bots/BotClient.cs b/src/Nocr.TelegramClient.AppServices/Bots/BotClient.cs index 47a418d..24c8b39 100644 --- a/src/Nocr.TelegramClient.AppServices/Bots/BotClient.cs +++ b/src/Nocr.TelegramClient.AppServices/Bots/BotClient.cs @@ -24,7 +24,7 @@ public sealed class BotClient : Bot } catch (Exception ex) { - _logger.LogError(ex, "Bot can't initiate conversation with a user: {message}", message); + _logger.LogError(ex, "Bot can't initiate conversation with a user: {message}.", message); throw; } } diff --git a/src/Nocr.TelegramClient.AppServices/Bots/BotExtensions.cs b/src/Nocr.TelegramClient.AppServices/Bots/BotExtensions.cs index dd5b24e..64711ac 100644 --- a/src/Nocr.TelegramClient.AppServices/Bots/BotExtensions.cs +++ b/src/Nocr.TelegramClient.AppServices/Bots/BotExtensions.cs @@ -19,7 +19,7 @@ public static class BotExtensions } catch (Exception ex) { - logger?.LogWarning(ex, "Не удалось отредактировать текстовое сообщение"); + logger?.LogWarning(ex, "Failed to edit text message."); } await bot.SendMessageAsync(message, CancellationToken.None); diff --git a/src/Nocr.TelegramClient.AppServices/Bots/MessageDispatcher/MessageDispatcherHandler.cs b/src/Nocr.TelegramClient.AppServices/Bots/MessageDispatcher/MessageDispatcherHandler.cs index 258c088..7953f16 100644 --- a/src/Nocr.TelegramClient.AppServices/Bots/MessageDispatcher/MessageDispatcherHandler.cs +++ b/src/Nocr.TelegramClient.AppServices/Bots/MessageDispatcher/MessageDispatcherHandler.cs @@ -40,7 +40,7 @@ public sealed class MessageDispatcherHandler : IMessageDispatcherHandler ex.Message.Equals("Forbidden: bot was blocked by the user", StringComparison.OrdinalIgnoreCase)) { - _logger.LogWarning("Bot was blocked by user {ChatId}, marking user as blocked", tm.ChatId); + _logger.LogWarning("Bot was blocked by user {ChatId}, marking user as blocked.", tm.ChatId); try { @@ -51,16 +51,16 @@ public sealed class MessageDispatcherHandler : IMessageDispatcherHandler await _usersService.BlockBot(user.Id, cancellationToken); await _textMatcherService.DeactivateAllUserSubscriptions(user.Id, cancellationToken); - _logger.LogInformation("Successfully blocked user {UserId} (ChatId: {ChatId}) and deactivated all subscriptions", user.Id, tm.ChatId); + _logger.LogInformation("Successfully blocked user {UserId} (ChatId: {ChatId}) and deactivated all subscriptions.", user.Id, tm.ChatId); } else { - _logger.LogWarning("Could not find user with ChatId {ChatId} to mark as blocked", tm.ChatId); + _logger.LogWarning("Could not find user with ChatId {ChatId} to mark as blocked.", tm.ChatId); } } catch (Exception blockEx) { - _logger.LogError(blockEx, "Failed to process user blocking for ChatId {ChatId}", tm.ChatId); + _logger.LogError(blockEx, "Failed to process user blocking for ChatId {ChatId}.", tm.ChatId); } } break; @@ -68,7 +68,7 @@ public sealed class MessageDispatcherHandler : IMessageDispatcherHandler await _bot.SendAnimationAsync(am, cancellationToken); break; default: - _logger.LogWarning("Dequeued message has unsupported type: {Type}", typeof(Message).FullName); + _logger.LogWarning("Dequeued message has unsupported type: {Type}.", typeof(Message).FullName); break; } } diff --git a/src/Nocr.TelegramClient.AppServices/Handlers/BaseHandlers/StartHandlerBase.cs b/src/Nocr.TelegramClient.AppServices/Handlers/BaseHandlers/StartHandlerBase.cs index 3d2323e..0b464a7 100644 --- a/src/Nocr.TelegramClient.AppServices/Handlers/BaseHandlers/StartHandlerBase.cs +++ b/src/Nocr.TelegramClient.AppServices/Handlers/BaseHandlers/StartHandlerBase.cs @@ -60,7 +60,7 @@ public abstract class StartHandlerBase } catch (Exception ex) { - _logger.LogWarning(ex, "Failed to delete message {MessageId} in chat {ChatId}", messageId, chatId); + _logger.LogWarning(ex, "Failed to delete message {MessageId} in chat {ChatId}.", messageId, chatId); } } diff --git a/src/Nocr.TelegramClient.AppServices/Handlers/CallbackQueries/ActivateSubscription/ActivateSubscriptionHandler.cs b/src/Nocr.TelegramClient.AppServices/Handlers/CallbackQueries/ActivateSubscription/ActivateSubscriptionHandler.cs index 24ebe31..64b109c 100644 --- a/src/Nocr.TelegramClient.AppServices/Handlers/CallbackQueries/ActivateSubscription/ActivateSubscriptionHandler.cs +++ b/src/Nocr.TelegramClient.AppServices/Handlers/CallbackQueries/ActivateSubscription/ActivateSubscriptionHandler.cs @@ -30,7 +30,7 @@ public class ActivateSubscriptionHandler : ViewSubscriptionHandlerBase, IMatchin { if (update.CallbackQuery is null) { - _logger.LogError("Не удалось выделить пользовательский колбэк.\n{@Update}", update); + _logger.LogError("Failed to extract user callback.\n{@Update}", update); return; } @@ -40,7 +40,7 @@ public class ActivateSubscriptionHandler : ViewSubscriptionHandlerBase, IMatchin if (callbackData.Args.Count != 1 || !long.TryParse(callbackData.Args.First(), out var subscriptionId)) { _logger.LogWarning( - "Не удалось извлечь идентификатор подписки. CallbackData: {@CallbackData}, ChatId: {ChatId}, MessageId {MessageId}.", + "Failed to extract subscription ID. CallbackData: {@CallbackData}, ChatId: {ChatId}, MessageId: {MessageId}.", callbackData, from, update.CallbackQuery?.Message?.Chat.Id); SendErrorMessage(from); return; @@ -52,14 +52,14 @@ public class ActivateSubscriptionHandler : ViewSubscriptionHandlerBase, IMatchin } catch (Exception ex) { - _logger.LogError(ex, "Не удалось деактивировать подписку."); + _logger.LogError(ex, "Failed to activate subscription."); SendErrorMessage(from); throw; } if (update.CallbackQuery.Message is null) { - _logger.LogError("Не удалось выделить идентификатор сообщения из пользовательского колбэка.\n{@CallbackQuery}", update.CallbackQuery); + _logger.LogError("Failed to extract message ID from user callback.\n{@CallbackQuery}", update.CallbackQuery); return; } diff --git a/src/Nocr.TelegramClient.AppServices/Handlers/CallbackQueries/AddSubscription/AddSubscriptionHandler.cs b/src/Nocr.TelegramClient.AppServices/Handlers/CallbackQueries/AddSubscription/AddSubscriptionHandler.cs index 1463247..337c7ca 100644 --- a/src/Nocr.TelegramClient.AppServices/Handlers/CallbackQueries/AddSubscription/AddSubscriptionHandler.cs +++ b/src/Nocr.TelegramClient.AppServices/Handlers/CallbackQueries/AddSubscription/AddSubscriptionHandler.cs @@ -51,7 +51,7 @@ public sealed class AddSubscriptionHandler : IMatchingUpdateHandler { if (update.CallbackQuery?.Message is null) { - _logger.LogError("Не удалось выделить идентификатор сообщения из пользовательского колбэка.\n{@CallbackQuery}", update.CallbackQuery); + _logger.LogError("Failed to extract message ID from user callback.\n{@CallbackQuery}", update.CallbackQuery); return Task.CompletedTask; } diff --git a/src/Nocr.TelegramClient.AppServices/Handlers/Messages/FeedbackMessage/FeedbackMessageHandler.cs b/src/Nocr.TelegramClient.AppServices/Handlers/Messages/FeedbackMessage/FeedbackMessageHandler.cs index 593cc1b..c338a62 100644 --- a/src/Nocr.TelegramClient.AppServices/Handlers/Messages/FeedbackMessage/FeedbackMessageHandler.cs +++ b/src/Nocr.TelegramClient.AppServices/Handlers/Messages/FeedbackMessage/FeedbackMessageHandler.cs @@ -73,7 +73,7 @@ public sealed class FeedbackMessageHandler : IMatchingUpdateHandler x.Type == UserIdentityType.TelegramId); if (identity == null) { - _logger.LogWarning("There is no identity with type '{IdentityType}' for user '{UserId}'", + _logger.LogWarning("There is no identity with type '{IdentityType}' for user '{UserId}'.", UserIdentityType.TelegramId, user.Id); return; } diff --git a/src/Nocr.TelegramClient.Core/BackgroundJobs/RepeatableBackgroundService.cs b/src/Nocr.TelegramClient.Core/BackgroundJobs/RepeatableBackgroundService.cs index 9cabde7..f97692f 100644 --- a/src/Nocr.TelegramClient.Core/BackgroundJobs/RepeatableBackgroundService.cs +++ b/src/Nocr.TelegramClient.Core/BackgroundJobs/RepeatableBackgroundService.cs @@ -34,7 +34,7 @@ public abstract class RepeatableBackgroundService : Backgrou } catch (Exception ex) { - _logger.LogCritical(ex, "Failed to process..."); + _logger.LogCritical(ex, "Failed to process."); await Task.Delay(_options.ExceptionInterval, stoppingToken); } }