Python getEffectiveLevel的作用

Python getEffectiveLevel的作用
#源碼

    def getEffectiveLevel(self):
        """
        Get the effective level for this logger.

        Loop through this logger and its parents in the logger hierarchy,
        looking for a non-zero logging level. Return the first one found.
        """
        logger = self
        while logger:
            if logger.level:
                return logger.level
            logger = logger.parent
        return NOTSET

#源碼解析:
此方法有很大的作用,用於判斷當前等級是否設置了等級,如果沒有設置繼續尋找父級別的level,直到找到level爲止。

發佈了14 篇原創文章 · 獲贊 1 · 訪問量 6562
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章