本文整理匯總了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)