mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #3146 from s0undt3ch/issues/3135
Redirect warnings to the logging system on python versions >= 2.6 Refs #3135
This commit is contained in:
commit
3afb744add
@ -181,6 +181,11 @@ if logging.getLoggerClass() is not Logging:
|
||||
# No handlers could be found for logger "foo"
|
||||
logging.getLogger().addHandler(LOGGING_NULL_HANDLER)
|
||||
|
||||
if sys.version_info >= (2, 7):
|
||||
# Python versions >= 2.7 allow warning to be redirected to the logging
|
||||
# system. Let's enable it.
|
||||
logging.captureWarnings(True)
|
||||
|
||||
|
||||
def getLogger(name): # pylint: disable-msg=C0103
|
||||
return logging.getLogger(name)
|
||||
|
Loading…
Reference in New Issue
Block a user