當前位置: 首頁>>代碼示例>>Python>>正文


Python Sentry.captureMessage方法代碼示例

本文整理匯總了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)
開發者ID:hlmnrmr,項目名稱:superdesk-core,代碼行數:19,代碼來源:sentry.py

示例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)
開發者ID:Xevib,項目名稱:osmbot,代碼行數:31,代碼來源:app.py


注:本文中的raven.contrib.flask.Sentry.captureMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。