mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Redirect warnings to the logging system on python versions >= 2.6 Refs #3135.
This commit is contained in:
parent
44f207df1c
commit
a71358e6df
@ -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, 6):
|
||||
# Python versions >= 2.6 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