lib: add improved log to sentry events being sent

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-11-29 21:37:29 +01:00
parent 9a393848b2
commit 917eef96fb
1 changed files with 3 additions and 0 deletions

View File

@ -93,6 +93,7 @@ def before_send(event: dict, hint: dict) -> Optional[dict]:
# End-user errors # End-user errors
Http404, Http404,
) )
exc_value = None
if "exc_info" in hint: if "exc_info" in hint:
_, exc_value, _ = hint["exc_info"] _, exc_value, _ = hint["exc_info"]
if isinstance(exc_value, ignored_classes): if isinstance(exc_value, ignored_classes):
@ -106,8 +107,10 @@ def before_send(event: dict, hint: dict) -> Optional[dict]:
"asyncio", "asyncio",
"multiprocessing", "multiprocessing",
"django_redis", "django_redis",
"django.security.DisallowedHost",
]: ]:
return None return None
LOGGER.debug("sending event to sentry", exc=exc_value, source_logger=event.get("logger", None))
if settings.DEBUG: if settings.DEBUG:
return None return None
return event return event