def METHOD_NAME(sender, exception, **extra):
    logger = logging.getLogger(__name__)
    message = ""
    if hasattr(exception, "data") and "message" in exception.data:
        message = exception.data['message']
    error = '{} {} {}'.format(exception.__class__.__name__, message, request.url)
    if isinstance(exception, (HTTPException, RegionNotFound)):
        logger.debug(error)
        if exception.code >= 500:
            record_exception()
    else:
        logger.exception(error)
        record_exception()