handlers.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:apm-agent-python 作者: elastic 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号