本文整理汇总了Python中flask.g.sentry_event_id方法的典型用法代码示例。如果您正苦于以下问题:Python g.sentry_event_id方法的具体用法?Python g.sentry_event_id怎么用?Python g.sentry_event_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flask.g
的用法示例。
在下文中一共展示了g.sentry_event_id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_body
# 需要导入模块: from flask import g [as 别名]
# 或者: from flask.g import sentry_event_id [as 别名]
def get_body(self, environ=None):
"""Get the request body."""
body = dict(
status=self.code,
message=self.get_description(environ),
error_module="ILS",
error_class=self.name,
)
errors = self.get_errors()
if self.errors:
body["errors"] = errors
if self.code and (self.code >= 500) and hasattr(g, "sentry_event_id"):
body["error_id"] = str(g.sentry_event_id)
return json.dumps(body)
示例2: context_processor
# 需要导入模块: from flask import g [as 别名]
# 或者: from flask.g import sentry_event_id [as 别名]
def context_processor():
return {
"random": random,
"application_settings": get_application_settings(),
"devs": get_administrators_list(),
"sentry_js_dsn": config.get("sentry-js-dsn", None),
"constants": constants,
"af_mode_enabled": datetime.datetime.now().date() == datetime.date(datetime.datetime.now().year, 4, 1),
"dbl_voted": session.get("unauthenticated", True) == False and bool(redis_store.get("DiscordBotsOrgVoted/" + str(session.get("user_id", -1)))),
"app_start_stamp": app_start_stamp
}
# @app.errorhandler(500)
# def internal_server_error(error):
# return render_template('500.html.j2',
# event_id=g.sentry_event_id,
# public_dsn=sentry.client.get_public_dsn('https')
# ), 500
示例3: _error_page
# 需要导入模块: from flask import g [as 别名]
# 或者: from flask.g import sentry_event_id [as 别名]
def _error_page(message: str, sentry_capture: bool = False, log: str = None):
"""return a error page with a message. if sentry is available, tell user that they can report the problem."""
sentry_param = {}
if sentry_capture and plugin_available("sentry"):
sentry.captureException()
sentry_param.update({"event_id": g.sentry_event_id,
"public_dsn": sentry.client.get_public_dsn('https')
})
if log:
logger.info(log)
return render_template('common/error.html', message=message, **sentry_param)
示例4: internal_server_error
# 需要导入模块: from flask import g [as 别名]
# 或者: from flask.g import sentry_event_id [as 别名]
def internal_server_error(e, context=None):
if context is None:
context = {
'error_title': 500,
'page_title': '500 Internal Server Error',
}
if sentry:
context['event_id'] = g.sentry_event_id
return render_template('error.html', **context), 500