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


Python LoggingProxy.writelines方法代码示例

本文整理汇总了Python中celery.utils.log.LoggingProxy.writelines方法的典型用法代码示例。如果您正苦于以下问题:Python LoggingProxy.writelines方法的具体用法?Python LoggingProxy.writelines怎么用?Python LoggingProxy.writelines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在celery.utils.log.LoggingProxy的用法示例。


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

示例1: test_logging_proxy

# 需要导入模块: from celery.utils.log import LoggingProxy [as 别名]
# 或者: from celery.utils.log.LoggingProxy import writelines [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

示例2: test_logging_proxy

# 需要导入模块: from celery.utils.log import LoggingProxy [as 别名]
# 或者: from celery.utils.log.LoggingProxy import writelines [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 writelines [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

示例4: test_logging_proxy

# 需要导入模块: from celery.utils.log import LoggingProxy [as 别名]
# 或者: from celery.utils.log.LoggingProxy import writelines [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.writelines方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。