mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
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:
parent
5b5b0210de
commit
ebab15285e
@ -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
|
||||
|
27
salt/log.py
27
salt/log.py
@ -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)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user