Reduced logging level to trace.

* In order to do the above, we switch the standard library's logging logger class as soon as possible with our own version which includes `trace()` and `garbage()`. Might also fix saltstack/salt-cloud#186.
This commit is contained in:
Pedro Algarvio 2012-12-04 12:59:49 +00:00
parent 5b5b0210de
commit ebab15285e
2 changed files with 11 additions and 19 deletions

View File

@ -615,8 +615,7 @@ class Loader(object):
# now that callable passes all the checks, add it to the
# library of available functions of this type
funcs[attr_name] = func
log.debug('Added {0} to {1}'.format(attr_name,
self.tag))
log.trace('Added {0} to {1}'.format(attr_name, self.tag))
self._apply_outputter(func, mod)
# now that all the functions have been collected, iterate back over

View File

@ -106,22 +106,20 @@ class Logging(LoggingLoggerClass):
return LoggingLoggerClass.log(self, TRACE, msg, *args, **kwargs)
def getLogger(name):
init()
return logging.getLogger(name)
def init():
if logging.getLoggerClass() is not Logging:
'''
Replace the default system logger with a version that includes trace()
and garbage() methods.
'''
if logging.getLoggerClass() is not Logging:
logging.setLoggerClass(Logging)
logging.addLevelName(TRACE, 'TRACE')
logging.addLevelName(GARBAGE, 'GARBAGE')
# Set the root logger at the lowest level possible
logging.getLogger().setLevel(GARBAGE)
logging.setLoggerClass(Logging)
logging.addLevelName(TRACE, 'TRACE')
logging.addLevelName(GARBAGE, 'GARBAGE')
# Set the root logger at the lowest level possible
logging.getLogger().setLevel(GARBAGE)
def getLogger(name):
return logging.getLogger(name)
def setup_console_logger(log_level='error', log_format=None, date_format=None):
@ -132,8 +130,6 @@ def setup_console_logger(log_level='error', log_format=None, date_format=None):
logging.getLogger(__name__).warn('Console logging already configured')
return
init()
if log_level is None:
log_level = 'warning'
@ -183,8 +179,6 @@ def setup_logfile_logger(log_path, log_level='error', log_format=None,
logging.getLogger(__name__).warn('Logfile logging already configured')
return
init()
if log_level is None:
log_level = 'warning'
@ -295,7 +289,6 @@ def set_logger_level(logger_name, log_level='error'):
'''
Tweak a specific logger's logging level
'''
init()
logging.getLogger(logger_name).setLevel(
LOG_LEVELS.get(log_level.lower(), logging.ERROR)
)