summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2014-04-15 13:24:53 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2014-04-15 13:24:53 (GMT)
commitddbd2ee6e5c3e50ba0b2d581ac10e9c4fdf19b14 (patch)
tree77d767ea1f656e1f23b0f0581bea106af05d2454 /Lib
parent4382ad6e02c2bbaefad52832dd522d1eaa9bc124 (diff)
downloadcpython-ddbd2ee6e5c3e50ba0b2d581ac10e9c4fdf19b14.zip
cpython-ddbd2ee6e5c3e50ba0b2d581ac10e9c4fdf19b14.tar.gz
cpython-ddbd2ee6e5c3e50ba0b2d581ac10e9c4fdf19b14.tar.bz2
Closes #21203: Updated fileConfig and dictConfig to remove inconsistencies. Thanks to Jure Koren for the patch.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/logging/config.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 895fb26..8a99923 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -116,11 +116,12 @@ def _create_formatters(cp):
sectname = "formatter_%s" % form
fs = cp.get(sectname, "format", raw=True, fallback=None)
dfs = cp.get(sectname, "datefmt", raw=True, fallback=None)
+ stl = cp.get(sectname, "style", raw=True, fallback='%')
c = logging.Formatter
class_name = cp[sectname].get("class")
if class_name:
c = _resolve(class_name)
- f = c(fs, dfs)
+ f = c(fs, dfs, stl)
formatters[form] = f
return formatters
@@ -660,7 +661,12 @@ class DictConfigurator(BaseConfigurator):
fmt = config.get('format', None)
dfmt = config.get('datefmt', None)
style = config.get('style', '%')
- result = logging.Formatter(fmt, dfmt, style)
+ cname = config.get('class', None)
+ if not cname:
+ c = logging.Formatter
+ else:
+ c = _resolve(cname)
+ result = c(fmt, dfmt, style)
return result
def configure_filter(self, config):