__init__.py 文件源码

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

项目:srep 作者: Answeror 项目源码 文件源码
def logging_context(path=None, level=None):
    from logbook import StderrHandler, FileHandler
    from logbook.compat import redirected_logging
    with StderrHandler(level=level or 'INFO').applicationbound():
        if path:
            if not os.path.isdir(os.path.dirname(path)):
                os.makedirs(os.path.dirname(path))
            with FileHandler(path, bubble=True).applicationbound():
                with redirected_logging():
                    yield
        else:
            with redirected_logging():
                yield
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号