def exception_handler(client, request=None, **kwargs):
def actually_do_stuff(request=None, **kwargs):
exc_info = sys.exc_info()
try:
if (django_settings.DEBUG and not client.config.debug) or getattr(exc_info[1], 'skip_elasticapm', False):
return
client.capture('Exception', exc_info=exc_info, request=request)
except Exception as exc:
try:
client.error_logger.exception(u'Unable to process log entry: %s' % (exc,))
except Exception as exc:
warnings.warn(u'Unable to process log entry: %s' % (exc,))
finally:
try:
del exc_info
except Exception as e:
client.error_logger.exception(e)
return actually_do_stuff(request, **kwargs)
评论列表
文章目录