Determining if root logger is set to DEBUG level in Python?

后端 未结 3 363
小鲜肉
小鲜肉 2020-12-23 19:55

If I set the logging module to DEBUG with a command line parameter like this:

if (opt[\"log\"] == \"debug\"):
  logging.basicConfig(level=logging.DEBUG)
         


        
3条回答
  •  臣服心动
    2020-12-23 20:56

    logging.getLogger().getEffectiveLevel()
    

    logging.getLogger() without arguments gets the root level logger.

    http://docs.python.org/library/logging.html#logging.Logger.getEffectiveLevel

提交回复
热议问题