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:
Thomas S Hatch 2013-01-04 10:42:54 -08:00
commit 3afb744add

View File

@ -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)