@@ -35,7 +35,6 @@ class Log:
3535 :meta private:
3636 """
3737
38- LOG_LEVEL = logging .NOTSET
3938 _logger = logging .getLogger (__name__ )
4039
4140 @classmethod
@@ -59,7 +58,6 @@ def apply_logging_config(cls, level, log_file_name):
5958 def setLevel (cls , level ):
6059 """Apply basic logging level"""
6160 cls ._logger .setLevel (level )
62- cls .LOG_LEVEL = level
6361
6462 @classmethod
6563 def build_msg (cls , txt , * args ):
@@ -90,39 +88,29 @@ def build_msg(cls, txt, *args):
9088 @classmethod
9189 def info (cls , txt , * args ):
9290 """Log info messagees."""
93- if cls .LOG_LEVEL == logging .NOTSET :
94- cls .LOG_LEVEL = cls ._logger .getEffectiveLevel ()
95- if logging .INFO >= cls .LOG_LEVEL :
91+ if cls ._logger .isEnabledFor (logging .INFO ):
9692 cls ._logger .info (cls .build_msg (txt , * args ))
9793
9894 @classmethod
9995 def debug (cls , txt , * args ):
10096 """Log debug messagees."""
101- if cls .LOG_LEVEL == logging .NOTSET :
102- cls .LOG_LEVEL = cls ._logger .getEffectiveLevel ()
103- if logging .DEBUG >= cls .LOG_LEVEL :
97+ if cls ._logger .isEnabledFor (logging .DEBUG ):
10498 cls ._logger .debug (cls .build_msg (txt , * args ))
10599
106100 @classmethod
107101 def warning (cls , txt , * args ):
108102 """Log warning messagees."""
109- if cls .LOG_LEVEL == logging .NOTSET :
110- cls .LOG_LEVEL = cls ._logger .getEffectiveLevel ()
111- if logging .WARNING >= cls .LOG_LEVEL :
103+ if cls ._logger .isEnabledFor (logging .WARNING ):
112104 cls ._logger .warning (cls .build_msg (txt , * args ))
113105
114106 @classmethod
115107 def error (cls , txt , * args ):
116108 """Log error messagees."""
117- if cls .LOG_LEVEL == logging .NOTSET :
118- cls .LOG_LEVEL = cls ._logger .getEffectiveLevel ()
119- if logging .ERROR >= cls .LOG_LEVEL :
109+ if cls ._logger .isEnabledFor (logging .ERROR ):
120110 cls ._logger .error (cls .build_msg (txt , * args ))
121111
122112 @classmethod
123113 def critical (cls , txt , * args ):
124114 """Log critical messagees."""
125- if cls .LOG_LEVEL == logging .NOTSET :
126- cls .LOG_LEVEL = cls ._logger .getEffectiveLevel ()
127- if logging .CRITICAL >= cls .LOG_LEVEL :
115+ if cls ._logger .isEnabledFor (logging .CRITICAL ):
128116 cls ._logger .critical (cls .build_msg (txt , * args ))
0 commit comments