python logging set level in basicConfig

前端 未结 1 1260
忘掉有多难
忘掉有多难 2021-01-18 13:19

python logging set level in basicConfig:

import logging

def show(level):
    logging.basicConfig(level=level)
    logging.info(\'info\')
    logging.debug(\         


        
相关标签:
1条回答
  • 2021-01-18 13:56

    According to logging.basicConfig documentation, the second call to logging.basicConfig does not take effect.

    This function does nothing if the root logger already has handlers configured for it.

    def show(level):
        logger = logging.getLogger()
        logger.setLevel(level)
        logging.info('info')
        ....
    
    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题