test_logging.py 文件源码

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

项目:pyethereum 作者: ethereumproject 项目源码 文件源码
def test_bound_logger(caplog):
    slogging.configure(config_string=':trace')
    real_log = slogging.getLogger()

    bound_log_1 = real_log.bind(key1="value1")
    with caplog.at_level(slogging.TRACE):
        bound_log_1.info("test1")
        assert "test1" in caplog.text
        assert 'key1=value1' in caplog.text

    bound_log_2 = bound_log_1.bind(key2="value2")
    with caplog.at_level(slogging.TRACE):
        bound_log_2.info("test2")
        assert "test2" in caplog.text
        assert 'key1=value1' in caplog.text
        assert 'key2=value2' in caplog.text
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号