本文整理汇总了Python中raven.contrib.flask.Sentry.captureMessage方法的典型用法代码示例。如果您正苦于以下问题:Python Sentry.captureMessage方法的具体用法?Python Sentry.captureMessage怎么用?Python Sentry.captureMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类raven.contrib.flask.Sentry
的用法示例。
在下文中一共展示了Sentry.captureMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SuperdeskSentry
# 需要导入模块: from raven.contrib.flask import Sentry [as 别名]
# 或者: from raven.contrib.flask.Sentry import captureMessage [as 别名]
class SuperdeskSentry():
"""Sentry proxy that will do nothing in case sentry is not configured."""
def __init__(self, app):
if app.config.get('SENTRY_DSN'):
app.config.setdefault('SENTRY_NAME', app.config.get('SERVER_NAME'))
self.sentry = Sentry(app, register_signal=False, wrap_wsgi=False)
else:
self.sentry = None
def captureException(self, exc_info=None, **kwargs):
if self.sentry:
self.sentry.captureException(exc_info, **kwargs)
def captureMessage(self, message, **kwargs):
if self.sentry:
self.sentry.captureMessage(message, **kwargs)
示例2: Flask
# 需要导入模块: from raven.contrib.flask import Sentry [as 别名]
# 或者: from raven.contrib.flask.Sentry import captureMessage [as 别名]
from flask import Flask, request, current_app
from bot import Osmbot
from configobj import ConfigObj
import os
from raven.contrib.flask import Sentry
import telegram
application = Flask(__name__)
application.debug = True
Osmbot(application, '')
config = ConfigObj('bot.conf')
token = config['token']
telegram_api = telegram.Bot(config['token'])
if 'sentry_dsn' in config:
application.config['sentry_dsn'] = config['sentry_dsn']
sentry = Sentry(application, dsn=config['sentry_dsn'])
sentry.captureMessage('OSMBot started', level=logging.INFO)
application.sentry = sentry
webhook = os.path.join(config['webhook'], config['token'])
application.logger.debug('webhook:%s', config['webhook'])
result = telegram_api.setWebhook(webhook)
if result:
application.logger.debug('Webhook set')
if __name__ == '__main__':
application.run(host='0.0.0.0', debug=True)