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


Python LoggingProxy.write方法代碼示例

本文整理匯總了Python中celery.utils.log.LoggingProxy.write方法的典型用法代碼示例。如果您正苦於以下問題:Python LoggingProxy.write方法的具體用法?Python LoggingProxy.write怎麽用?Python LoggingProxy.write使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在celery.utils.log.LoggingProxy的用法示例。


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

示例1: test_logging_proxy_recurse_protection

# 需要導入模塊: from celery.utils.log import LoggingProxy [as 別名]
# 或者: from celery.utils.log.LoggingProxy import write [as 別名]
 def test_logging_proxy_recurse_protection(self):
     logger = self.setup_logger(loglevel=logging.ERROR, logfile=None, root=False)
     p = LoggingProxy(logger, loglevel=logging.ERROR)
     p._thread.recurse_protection = True
     try:
         self.assertIsNone(p.write("FOOFO"))
     finally:
         p._thread.recurse_protection = False
開發者ID:m4ddav3,項目名稱:celery,代碼行數:10,代碼來源:test_log.py

示例2: test_logging_proxy

# 需要導入模塊: from celery.utils.log import LoggingProxy [as 別名]
# 或者: from celery.utils.log.LoggingProxy import write [as 別名]
    def test_logging_proxy(self):
        logger = self.setup_logger(loglevel=logging.ERROR, logfile=None, root=False)

        with wrap_logger(logger) as sio:
            p = LoggingProxy(logger, loglevel=logging.ERROR)
            p.close()
            p.write("foo")
            self.assertNotIn("foo", sio.getvalue())
            p.closed = False
            p.write("foo")
            self.assertIn("foo", sio.getvalue())
            lines = ["baz", "xuzzy"]
            p.writelines(lines)
            for line in lines:
                self.assertIn(line, sio.getvalue())
            p.flush()
            p.close()
            self.assertFalse(p.isatty())
            self.assertIsNone(p.fileno())
開發者ID:bmihelac,項目名稱:celery,代碼行數:21,代碼來源:test_log.py

示例3: test_logging_proxy

# 需要導入模塊: from celery.utils.log import LoggingProxy [as 別名]
# 或者: from celery.utils.log.LoggingProxy import write [as 別名]
    def test_logging_proxy(self):
        with restore_logging():
            logger = self.setup_logger(loglevel=logging.ERROR, logfile=None,
                                       root=False)

            with wrap_logger(logger) as sio:
                p = LoggingProxy(logger, loglevel=logging.ERROR)
                p.close()
                p.write('foo')
                self.assertNotIn('foo', sio.getvalue())
                p.closed = False
                p.write('foo')
                self.assertIn('foo', sio.getvalue())
                lines = ['baz', 'xuzzy']
                p.writelines(lines)
                for line in lines:
                    self.assertIn(line, sio.getvalue())
                p.flush()
                p.close()
                self.assertFalse(p.isatty())

                with override_stdouts() as (stdout, stderr):
                    with in_sighandler():
                        p.write('foo')
                        self.assertTrue(stderr.getvalue())
開發者ID:Deepthi-Chand,項目名稱:celery,代碼行數:27,代碼來源:test_log.py

示例4: test_logging_proxy

# 需要導入模塊: from celery.utils.log import LoggingProxy [as 別名]
# 或者: from celery.utils.log.LoggingProxy import write [as 別名]
    def test_logging_proxy(self):
        logger = self.setup_logger(loglevel=logging.ERROR, logfile=None, root=False)

        with mock.wrap_logger(logger) as sio:
            p = LoggingProxy(logger, loglevel=logging.ERROR)
            p.close()
            p.write("foo")
            self.assertNotIn("foo", sio.getvalue())
            p.closed = False
            p.write("foo")
            self.assertIn("foo", sio.getvalue())
            lines = ["baz", "xuzzy"]
            p.writelines(lines)
            for line in lines:
                self.assertIn(line, sio.getvalue())
            p.flush()
            p.close()
            self.assertFalse(p.isatty())

            with mock.stdouts() as (stdout, stderr):
                with in_sighandler():
                    p.write("foo")
                    self.assertTrue(stderr.getvalue())
開發者ID:m4ddav3,項目名稱:celery,代碼行數:25,代碼來源:test_log.py

示例5: test_logging_proxy

# 需要導入模塊: from celery.utils.log import LoggingProxy [as 別名]
# 或者: from celery.utils.log.LoggingProxy import write [as 別名]
    def test_logging_proxy(self):
        logger = self.setup_logger(loglevel=logging.ERROR, logfile=None,
                                   root=False)

        with mock.wrap_logger(logger) as sio:
            p = LoggingProxy(logger, loglevel=logging.ERROR)
            p.close()
            p.write('foo')
            assert 'foo' not in sio.getvalue()
            p.closed = False
            p.write('foo')
            assert 'foo' in sio.getvalue()
            lines = ['baz', 'xuzzy']
            p.writelines(lines)
            for line in lines:
                assert line in sio.getvalue()
            p.flush()
            p.close()
            assert not p.isatty()

            with mock.stdouts() as (stdout, stderr):
                with in_sighandler():
                    p.write('foo')
                    assert stderr.getvalue()
開發者ID:maniacs-ops,項目名稱:celery,代碼行數:26,代碼來源:test_log.py


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