mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Warn on Python < 2.7 for dictConfig
This commit is contained in:
parent
a7d4491a71
commit
783c9bee3e
@ -231,10 +231,22 @@ class Logger(object):
|
|||||||
self.access_log, cfg, self.syslog_fmt, "access"
|
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:
|
if dictConfig and cfg.logconfig_dict:
|
||||||
config = CONFIG_DEFAULTS.copy()
|
config = CONFIG_DEFAULTS.copy()
|
||||||
config.update(cfg.logconfig_dict)
|
config.update(cfg.logconfig_dict)
|
||||||
dictConfig(config)
|
try:
|
||||||
|
dictConfig(config)
|
||||||
|
except (
|
||||||
|
AttributeError,
|
||||||
|
ImportError,
|
||||||
|
ValueError,
|
||||||
|
TypeError
|
||||||
|
) as exc:
|
||||||
|
raise RuntimeError(str(exc))
|
||||||
elif cfg.logconfig:
|
elif cfg.logconfig:
|
||||||
if os.path.exists(cfg.logconfig):
|
if os.path.exists(cfg.logconfig):
|
||||||
defaults = CONFIG_DEFAULTS.copy()
|
defaults = CONFIG_DEFAULTS.copy()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user