test_logging.py 文件源码

python
阅读 43 收藏 0 点赞 0 评论 0

项目:deb-python-txaio 作者: openstack 项目源码 文件源码
def test_txlog_write_text(handler, framework_tx):
    """
    Writing to a text stream is supported.
    """
    pytest.importorskip("twisted.logger")
    from txaio.tx import _LogObserver

    out_file = StringIO()
    observer = _LogObserver(out_file)

    observer({
        "log_format": "hi: {testentry}",
        "testentry": "hello",
        "log_level": observer.to_tx["info"],
        "log_time": 1442890018.002233
    })

    output = out_file.getvalue()
    assert u"hi: hello" in output
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号