当前位置: 首页>>代码示例>>Python>>正文


Python models.get_client函数代码示例

本文整理汇总了Python中sentry.client.models.get_client函数的典型用法代码示例。如果您正苦于以下问题:Python get_client函数的具体用法?Python get_client怎么用?Python get_client使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_client函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testAlternateDatabase

 def testAlternateDatabase(self):
     settings.DATABASE_USING = 'default'
     
     try:
         Message.objects.get(id=999999979)
     except Message.DoesNotExist, exc:
         get_client().create_from_exception(exc)
开发者ID:klipstein,项目名称:django-sentry,代码行数:7,代码来源:tests.py

示例2: testExclusionViewPath

 def testExclusionViewPath(self):
     try: Message.objects.get(pk=1341324)
     except: get_client().create_from_exception()
     
     last = Message.objects.get()
     
     self.assertEquals(last.view, 'sentry.tests.tests.testExclusionViewPath')
开发者ID:carmi,项目名称:django-sentry,代码行数:7,代码来源:tests.py

示例3: emit

    def emit(self, record):
        from sentry.client.models import get_client

        # Avoid typical config issues by overriding loggers behavior
        if record.name == 'sentry.errors':
            print >> sys.stderr, "Recursive log message sent to SentryHandler"
            print >> sys.stderr, record.message
            return

        get_client().create_from_record(record)
开发者ID:Bounder,项目名称:django-sentry,代码行数:10,代码来源:handlers.py

示例4: test_best_guess_view

 def test_best_guess_view(self):
     settings.EXCLUDE_PATHS = ['tests.tests']
     
     try: Message.objects.get(pk=1341324)
     except: get_client().create_from_exception()
     
     last = Message.objects.get()
     
     self.assertEquals(last.view, 'tests.tests.test_best_guess_view')
     
     settings.EXCLUDE_PATHS = []
开发者ID:olarcheveque,项目名称:django-sentry,代码行数:11,代码来源:tests.py

示例5: testBestGuessView

 def testBestGuessView(self):
     conf.EXCLUDE_PATHS = ['sentry.tests.tests']
     
     try: Message.objects.get(pk=1341324)
     except: get_client().create_from_exception()
     
     last = Message.objects.get()
     
     self.assertEquals(last.view, 'sentry.tests.tests.testBestGuessView')
     
     conf.EXCLUDE_PATHS = []
开发者ID:carmi,项目名称:django-sentry,代码行数:11,代码来源:tests.py

示例6: log_with_stacktrace

def log_with_stacktrace(message, level=logging.INFO, logger='hiicart.audit'):
    client = get_client()
    if client is None:
        logger = logging.get_logger()
        logger.warn("Could not save stack trace for message: %s" % message)
        return
    kwargs = dict(level=level, logger=logger)
    stack = inspect.stack()[1:]
    tb = FakeTraceback(stack)
    exc_info = (AuditingStacktrace, AuditingStacktrace(message), tb)
    get_client().create_from_exception(exc_info, **kwargs)
开发者ID:kbourgoin,项目名称:hiicart,代码行数:11,代码来源:auditing.py

示例7: testThrashing

 def testThrashing(self):
     settings.THRASHING_LIMIT = 10
     settings.THRASHING_TIMEOUT = 60
     
     Message.objects.all().delete()
     GroupedMessage.objects.all().delete()
     
     for i in range(0, 50):
         get_client().create_from_text('hi')
     
     self.assertEquals(Message.objects.count(), settings.THRASHING_LIMIT)
开发者ID:klipstein,项目名称:django-sentry,代码行数:11,代码来源:tests.py

示例8: testNoThrashing

    def testNoThrashing(self):
        prev = settings.THRASHING_LIMIT
        settings.THRASHING_LIMIT = 0
        
        Message.objects.all().delete()
        GroupedMessage.objects.all().delete()
        
        for i in range(0, 50):
            get_client().create_from_text('hi')
        
        self.assertEquals(Message.objects.count(), 50)

        settings.THRASHING_LIMIT = prev
开发者ID:klipstein,项目名称:django-sentry,代码行数:13,代码来源:tests.py

示例9: emit

    def emit(self, record):
        from sentry.client.models import get_client
        from sentry.client.middleware import SentryLogMiddleware

        # Fetch the request from a threadlocal variable, if available
        request = getattr(SentryLogMiddleware.thread, "request", None)

        # Avoid typical config issues by overriding loggers behavior
        if record.name == "sentry.errors":
            print >>sys.stderr, "Recursive log message sent to SentryHandler"
            print >>sys.stderr, record.message
            return

        get_client().create_from_record(record, request=request)
开发者ID:harmv,项目名称:django-sentry,代码行数:14,代码来源:handlers.py

示例10: testLongURLs

    def testLongURLs(self):
        # Fix: #6 solves URLs > 200 characters
        message_id = get_client().create_from_text('hello world', url='a'*210)
        error = Message.objects.get(message_id=message_id)

        self.assertEquals(error.url, 'a'*200)
        self.assertEquals(error.data['url'], 'a'*210)
开发者ID:carmi,项目名称:django-sentry,代码行数:7,代码来源:tests.py

示例11: testAPI

 def testAPI(self):
     try:
         Message.objects.get(id=999999989)
     except Message.DoesNotExist, exc:
         message_id = get_client().create_from_exception()
         error = Message.objects.get(message_id=message_id)
         self.assertTrue(error.data.get('__sentry__', {}).get('exc'))
开发者ID:carmi,项目名称:django-sentry,代码行数:7,代码来源:tests.py

示例12: process_response

 def process_response(self, request, response):
     if response.status_code == 404 and request.META.get('HTTP_REFERER', '') and not sentry_settings.DEBUG:
         request.META['TURANUSER'] = request.user
         message_id = get_client().create_from_text('Http 404 %s' %request.path, request=request, level=logging.INFO, logger='http404')
         request.sentry = {
             'id': message_id,
             }
     return response
开发者ID:bolav,项目名称:Turan,代码行数:8,代码来源:middleware.py

示例13: process_response

 def process_response(self, request, response):
     if response.status_code != 404:
         return response
     message_id = get_client().create_from_text('Http 404', request=request, level=logging.INFO, logger='http404')
     request.sentry = {
         'id': message_id,
     }
     return response
开发者ID:TradeHill2011,项目名称:django-sentry,代码行数:8,代码来源:middleware.py

示例14: test_thrashing

    def test_thrashing(self):
        settings.THRASHING_LIMIT = 10
        settings.THRASHING_TIMEOUT = 60
        
        Message.objects.all().delete()
        GroupedMessage.objects.all().delete()
        
        message_id = None
        for i in range(0, 10):
            this_message_id = get_client().create_from_text('hi')
            self.assertTrue(this_message_id is not None)
            self.assertNotEquals(this_message_id, message_id)
            message_id = this_message_id

        for i in range(0, 40):
            this_message_id = get_client().create_from_text('hi')
            self.assertEquals(this_message_id, message_id)
        
        self.assertEquals(Message.objects.count(), settings.THRASHING_LIMIT)
开发者ID:olarcheveque,项目名称:django-sentry,代码行数:19,代码来源:tests.py

示例15: main_thread_terminated

def main_thread_terminated():
    client = get_client()
    if isinstance(client, AsyncSentryClient):
        size = client.queue.qsize()
        if size:
            print "Sentry attempts to send %s error messages" % size
            print "Waiting up to %s seconds" % SENTRY_WAIT_SECONDS
            if os.name == 'nt':
                print "Press Ctrl-Break to quit"
            else:
                print "Press Ctrl-C to quit"
            client.stop(timeout = SENTRY_WAIT_SECONDS)
开发者ID:Torkn,项目名称:django-sentry,代码行数:12,代码来源:async.py


注:本文中的sentry.client.models.get_client函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。