utils.py 文件源码

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

项目:python-zhmcclient 作者: zhmcclient 项目源码 文件源码
def reset_logger(log_comp):
    """
    Reset the logger for the specified log component (unless it is the root
    logger) to add a NullHandler if it does not have any handlers. Having a
    handler prevents a log request to be propagated to the parent logger.
    """

    name = LOGGER_NAMES[log_comp]
    logger = logging.getLogger(name)

    if name != '' and not logger.handlers:
        logger.addHandler(logging.NullHandler())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号