From 4edda07ceedd09e43151fa06ccad5d5715f48f19 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 23 Nov 2021 17:32:03 +0100 Subject: [PATCH] Improved logging --- src/gismo_core/service/message_service.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gismo_core/service/message_service.py b/src/gismo_core/service/message_service.py index 6a90d79..32ae1c3 100644 --- a/src/gismo_core/service/message_service.py +++ b/src/gismo_core/service/message_service.py @@ -28,16 +28,16 @@ class MessageService(MessageServiceABC): async def delete_message(self, message: discord.Message): server_st: ServerSettings = self._config.get_configuration(f'DSERVER_{message.guild.id}') await asyncio.sleep(server_st.message_delete_timer) - self._logger.debug(__name__, f'Try to delete message: {message.content}') + self._logger.debug(__name__, f'Try to delete message:\n\t{message}\n\t{message.content}') try: await message.delete() except Exception as e: self._logger.error(__name__, f'Deleting message failed', e) else: - self._logger.info(__name__, f'Deleted message {message.content}') + self._logger.info(__name__, f'Deleted message {message}') async def send_channel_message(self, channel: discord.TextChannel, message: str): - self._logger.debug(__name__, f'Try to send message {message} to channel {channel.id}') + self._logger.debug(__name__, f'Try to send message\n\t{message}\n\tto: {channel}') msg = None try: msg = await channel.send(message) @@ -48,7 +48,7 @@ class MessageService(MessageServiceABC): await self.delete_message(msg) async def send_dm_message(self, message: str, receiver: Union[discord.User, discord.Member]): - self._logger.debug(__name__, f'Try to send message {message} to user {receiver.id}') + self._logger.debug(__name__, f'Try to send message\n\t{message}\n\tto: {receiver}') try: await receiver.send(message) except Exception as e: @@ -62,7 +62,7 @@ class MessageService(MessageServiceABC): self._logger.debug(__name__, f'Message: {message}') return - self._logger.debug(__name__, f'Try to send message {message} to channel {ctx.channel.id}') + self._logger.debug(__name__, f'Try to send message\t\t{message}\n\tto: {ctx.channel}') msg = None try: if isinstance(message, discord.File):