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


Python handlers.SentryHandler類代碼示例

本文整理匯總了Python中raven.contrib.django.handlers.SentryHandler的典型用法代碼示例。如果您正苦於以下問題:Python SentryHandler類的具體用法?Python SentryHandler怎麽用?Python SentryHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了SentryHandler類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_record_none_exc_info

    def test_record_none_exc_info(self):
        # sys.exc_info can return (None, None, None) if no exception is being
        # handled anywhere on the stack. See:
        #  http://docs.python.org/library/sys.html#sys.exc_info
        record = logging.LogRecord(
            "foo", logging.INFO, pathname=None, lineno=None, msg="test", args=(), exc_info=(None, None, None)
        )
        handler = SentryHandler()
        handler.emit(record)

        self.assertEquals(len(self.raven.events), 1)
        event = self.raven.events.pop(0)
        self.assertEquals(event["message"], "test")
開發者ID:nuklea,項目名稱:raven-python,代碼行數:13,代碼來源:tests.py

示例2: SentryHandler

SENTRY_CACHE_BACKEND = 'default'

EMAIL_SUBJECT_PREFIX = '[Sentry] '

# Configure logging
from raven.conf import setup_logging
from raven.contrib.django.handlers import SentryHandler
import logging

# Configure root logger
logger = logging.getLogger()
logger.setLevel(logging.INFO)

handler = logging.StreamHandler()
handler.setLevel(logging.INFO)
logger.addHandler(handler)

# Disable django.request as it's generally useless
logger = logging.getLogger('django.request')
logger.propagate = False
logger.addHandler(handler)

# Configure default sentry logging
sentry_handler = SentryHandler()
sentry_handler.setLevel(logging.ERROR)
setup_logging(sentry_handler)

# Configure celery
import djcelery
djcelery.setup_loader()
開發者ID:alvra,項目名稱:sentry,代碼行數:30,代碼來源:server.py


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