Warn on Python < 2.7 for dictConfig

This commit is contained in:
Randall Leeds 2017-10-29 21:44:10 -07:00
parent a7d4491a71
commit 783c9bee3e

View File

@ -231,10 +231,22 @@ class Logger(object):
self.access_log, cfg, self.syslog_fmt, "access"
)
if dictConfig is None and cfg.logconfig_dict:
util.warn("Dictionary-based log configuration requires "
"Python 2.7 or above.")
if dictConfig and cfg.logconfig_dict:
config = CONFIG_DEFAULTS.copy()
config.update(cfg.logconfig_dict)
dictConfig(config)
try:
dictConfig(config)
except (
AttributeError,
ImportError,
ValueError,
TypeError
) as exc:
raise RuntimeError(str(exc))
elif cfg.logconfig:
if os.path.exists(cfg.logconfig):
defaults = CONFIG_DEFAULTS.copy()