Patch #1779550: remove redundant code in logging.

This commit is contained in:
Georg Brandl 2007-08-23 21:55:57 +00:00
parent 3761422749
commit daa6f254c6
1 changed files with 3 additions and 15 deletions

View File

@ -974,9 +974,7 @@ class Logger(Filterer):
logger.debug("Houston, we have a %s", "thorny problem", exc_info=1) logger.debug("Houston, we have a %s", "thorny problem", exc_info=1)
""" """
if self.manager.disable >= DEBUG: if self.isEnabledFor(DEBUG):
return
if DEBUG >= self.getEffectiveLevel():
apply(self._log, (DEBUG, msg, args), kwargs) apply(self._log, (DEBUG, msg, args), kwargs)
def info(self, msg, *args, **kwargs): def info(self, msg, *args, **kwargs):
@ -988,9 +986,7 @@ class Logger(Filterer):
logger.info("Houston, we have a %s", "interesting problem", exc_info=1) logger.info("Houston, we have a %s", "interesting problem", exc_info=1)
""" """
if self.manager.disable >= INFO: if self.isEnabledFor(INFO):
return
if INFO >= self.getEffectiveLevel():
apply(self._log, (INFO, msg, args), kwargs) apply(self._log, (INFO, msg, args), kwargs)
def warning(self, msg, *args, **kwargs): def warning(self, msg, *args, **kwargs):
@ -1002,8 +998,6 @@ class Logger(Filterer):
logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1) logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1)
""" """
if self.manager.disable >= WARNING:
return
if self.isEnabledFor(WARNING): if self.isEnabledFor(WARNING):
apply(self._log, (WARNING, msg, args), kwargs) apply(self._log, (WARNING, msg, args), kwargs)
@ -1018,8 +1012,6 @@ class Logger(Filterer):
logger.error("Houston, we have a %s", "major problem", exc_info=1) logger.error("Houston, we have a %s", "major problem", exc_info=1)
""" """
if self.manager.disable >= ERROR:
return
if self.isEnabledFor(ERROR): if self.isEnabledFor(ERROR):
apply(self._log, (ERROR, msg, args), kwargs) apply(self._log, (ERROR, msg, args), kwargs)
@ -1038,9 +1030,7 @@ class Logger(Filterer):
logger.critical("Houston, we have a %s", "major disaster", exc_info=1) logger.critical("Houston, we have a %s", "major disaster", exc_info=1)
""" """
if self.manager.disable >= CRITICAL: if self.isEnabledFor(CRITICAL):
return
if CRITICAL >= self.getEffectiveLevel():
apply(self._log, (CRITICAL, msg, args), kwargs) apply(self._log, (CRITICAL, msg, args), kwargs)
fatal = critical fatal = critical
@ -1059,8 +1049,6 @@ class Logger(Filterer):
raise TypeError, "level must be an integer" raise TypeError, "level must be an integer"
else: else:
return return
if self.manager.disable >= level:
return
if self.isEnabledFor(level): if self.isEnabledFor(level):
apply(self._log, (level, msg, args), kwargs) apply(self._log, (level, msg, args), kwargs)