本文整理汇总了Python中sentry.models.Event.get_level_display方法的典型用法代码示例。如果您正苦于以下问题:Python Event.get_level_display方法的具体用法?Python Event.get_level_display怎么用?Python Event.get_level_display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sentry.models.Event
的用法示例。
在下文中一共展示了Event.get_level_display方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: group_json
# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import get_level_display [as 别名]
def group_json(request, project, group_id):
group = get_object_or_404(Group, pk=group_id)
if group.project and group.project != project:
return HttpResponse(status_code=404)
try:
event = group.get_latest_event()
except IndexError:
# It's possible that a message would not be created under certain circumstances
# (such as a post_save signal failing)
event = Event()
# We use a SortedDict to keep elements ordered for the JSON serializer
data = SortedDict()
data['id'] = event.event_id
data['checksum'] = event.checksum
data['project'] = event.project_id
data['logger'] = event.logger
data['level'] = event.get_level_display()
data['culprit'] = event.culprit
for k, v in sorted(event.data.iteritems()):
data[k] = v
return HttpResponse(json.dumps(data), mimetype='application/json')