feat: Add logging

This commit is contained in:
moanos [he/him] 2025-01-01 14:34:38 +01:00
parent f2e2599561
commit fef211b2d0

View File

@ -12,6 +12,7 @@ def notify_search_subscribers(adoption_notice: AdoptionNotice, only_if_active :
If the new adoption notice fits the search subscription, it sends a notification to the user that created the search.
"""
if only_if_active and not adoption_notice.is_active:
logging.warning(f"No notifications triggered for adoption notice {adoption_notice} because it's not active.")
return
for search_subscription in SearchSubscription.objects.all():
search = Search(search_subscription=search_subscription)
@ -22,6 +23,8 @@ def notify_search_subscribers(adoption_notice: AdoptionNotice, only_if_active :
adoption_notice=adoption_notice,
text=notification_text)
logging.info(f"Subscribers for AN {adoption_notice.pk} have been notified")
class Search:
def __init__(self, request=None, search_subscription=None):