From 4a0a6a4631feeaa1fdceace6dd8964b9c4762d8c Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Thu, 30 Mar 2023 14:43:21 +0200 Subject: [PATCH] Improved logging to app end --- kdb-bot/src/bot/main.py | 2 +- kdb-bot/src/modules/level/events/level_on_message_event.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kdb-bot/src/bot/main.py b/kdb-bot/src/bot/main.py index 88e48aa0..1b240eca 100644 --- a/kdb-bot/src/bot/main.py +++ b/kdb-bot/src/bot/main.py @@ -39,7 +39,7 @@ class Program: ) self.app: Application = await app_builder.build_async() await self.app.run_async() - Console.write_line("Finished app.run_async") + Console.write_line(f"[ INFO ] [ {__name__} ]: Finished app.run_async") async def stop(self): if self.app is None: diff --git a/kdb-bot/src/modules/level/events/level_on_message_event.py b/kdb-bot/src/modules/level/events/level_on_message_event.py index 104080ff..8bdd054c 100644 --- a/kdb-bot/src/modules/level/events/level_on_message_event.py +++ b/kdb-bot/src/modules/level/events/level_on_message_event.py @@ -15,4 +15,7 @@ class LevelOnMessageEvent(OnMessageABC): @EventChecks.check_is_ready() async def on_message(self, message: discord.Message): self._logger.debug(__name__, f"Module {type(self)} started") - await self._level.check_level(message.author) + try: + await self._level.check_level(message.author) + except Exception as e: + self._logger.error(__name__, f"Level check by message failed", e)