From ad3fc94923c807b1ac604f0f672c2ac73bc01758 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sat, 9 Dec 2023 13:58:38 +0100 Subject: [PATCH] Improved logging for event_service --- bot/src/modules/base/service/event_service.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bot/src/modules/base/service/event_service.py b/bot/src/modules/base/service/event_service.py index 63066353..ae48756f 100644 --- a/bot/src/modules/base/service/event_service.py +++ b/bot/src/modules/base/service/event_service.py @@ -99,6 +99,7 @@ class EventService: async def check_and_create_scheduled_events(self, guild: Guild): server = self._servers.get_server_by_discord_id(guild.id) scheduled_events_from_db = self._events.get_scheduled_events_by_server_id(server.id) + self._logger.debug(__name__, f"Checking {scheduled_events_from_db.count()} events for server {guild.id}") for scheduled_event in scheduled_events_from_db: scheduled_event: ScheduledEvent = scheduled_event from_guild = List(DiscordEvent, guild.scheduled_events).where( @@ -107,6 +108,7 @@ class EventService: and x.entity_type == scheduled_event.entity_type ) if from_guild.count() != 0: + self._logger.debug(__name__, f"Event {scheduled_event.name} already exists on discord server") continue kwargs = {"name": scheduled_event.name, "description": scheduled_event.description} @@ -135,9 +137,10 @@ class EventService: kwargs["privacy_level"] = PrivacyLevel.guild_only try: - self._logger.debug(__name__, f"Try to create scheduled event for guild {guild.name}") + self._logger.trace(__name__, f"Try to create scheduled event for guild {guild.name}") await guild.create_scheduled_event(**kwargs) self._events.update_scheduled_event(scheduled_event) self._db.save_changes() + self._logger.debug(__name__, f"Created scheduled event for guild {guild.name}") except Exception as e: self._logger.error(__name__, f"Watching scheduled events failed", e)