diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2013-03-29 17:56:54 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2013-03-29 17:56:54 (GMT) |
commit | 28421c6f6264ed33aea31a161ebd77f935437d3f (patch) | |
tree | 8e42fd8320c087eeffa46953975d0bea02cdc8cd /Lib/logging/config.py | |
parent | 6d2bc6e80b53658bd249480c3e1172b7546caea1 (diff) | |
download | cpython-28421c6f6264ed33aea31a161ebd77f935437d3f.zip cpython-28421c6f6264ed33aea31a161ebd77f935437d3f.tar.gz cpython-28421c6f6264ed33aea31a161ebd77f935437d3f.tar.bz2 |
Issue #17540: Added style to Formatter configuration by dict.
Diffstat (limited to 'Lib/logging/config.py')
-rw-r--r-- | Lib/logging/config.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py index 11e79a2..1880614 100644 --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -669,7 +669,8 @@ class DictConfigurator(BaseConfigurator): else: fmt = config.get('format', None) dfmt = config.get('datefmt', None) - result = logging.Formatter(fmt, dfmt) + style = config.get('style', '%') + result = logging.Formatter(fmt, dfmt, style) return result def configure_filter(self, config): @@ -691,6 +692,7 @@ class DictConfigurator(BaseConfigurator): def configure_handler(self, config): """Configure a handler from a dictionary.""" + config_copy = dict(config) # for restoring in case of error formatter = config.pop('formatter', None) if formatter: try: @@ -714,7 +716,7 @@ class DictConfigurator(BaseConfigurator): try: th = self.config['handlers'][config['target']] if not isinstance(th, logging.Handler): - config['class'] = cname # restore for deferred configuration + config.update(config_copy) # restore for deferred cfg raise TypeError('target not configured yet') config['target'] = th except Exception as e: |