_logging.py 文件源码

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

项目:python-zhmcclient 作者: zhmcclient 项目源码 文件源码
def get_logger(name):
    """
    Return a :class:`~py:logging.Logger` object with the specified name.

    A :class:`~py:logging.NullHandler` handler is added to the logger if it
    does not have any handlers yet and if it is not the Python root logger.
    This prevents the propagation of log requests up the Python logger
    hierarchy, and therefore causes this package to be silent by default.
    """
    logger = logging.getLogger(name)
    if name != '' and not logger.handlers:
        logger.addHandler(logging.NullHandler())
    return logger
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号