Skip to content

Commit

Permalink
🔊 add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
YousefEZ committed Sep 25, 2024
1 parent d95979f commit 99aea31
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions view/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ def display_notification(self, notification: ScheduledNotification) -> None:

async def render(self, notification: host.notifier.Notification) -> None:
logging.debug("[NOTIFICATION][SENDING] UserId=%s", notification.user_id)
user = await self.bot.fetch_user(notification.user_id)
await user.send(
**self._renderer.render("notification", keywords={"notification": notification}).dict()
)
logging.debug("[NOTIFICATION][SENT] UserId=%s", notification.user_id)
try:
user = await self.bot.fetch_user(notification.user_id)
await user.send(
**self._renderer.render(
"notification", keywords={"notification": notification}
).dict()
)
except Exception as e:
logging.error("[NOTIFICATION][ERROR] UserId=%s, Error=%s", notification.user_id, e)
else:
logging.debug("[NOTIFICATION][SENT] UserId=%s", notification.user_id)

def start(self) -> None:
self.notifier.start()

0 comments on commit 99aea31

Please sign in to comment.