mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-110875: Handle '.' properties in logging formatter configuration c… (GH-110943)
This commit is contained in:
parent
7d21e3d5ee
commit
a5f29c9faf
2 changed files with 41 additions and 5 deletions
|
@ -482,10 +482,10 @@ class BaseConfigurator(object):
|
|||
c = config.pop('()')
|
||||
if not callable(c):
|
||||
c = self.resolve(c)
|
||||
props = config.pop('.', None)
|
||||
# Check for valid identifiers
|
||||
kwargs = {k: config[k] for k in config if valid_ident(k)}
|
||||
kwargs = {k: config[k] for k in config if (k != '.' and valid_ident(k))}
|
||||
result = c(**kwargs)
|
||||
props = config.pop('.', None)
|
||||
if props:
|
||||
for name, value in props.items():
|
||||
setattr(result, name, value)
|
||||
|
@ -835,8 +835,7 @@ class DictConfigurator(BaseConfigurator):
|
|||
factory = functools.partial(self._configure_queue_handler, klass)
|
||||
else:
|
||||
factory = klass
|
||||
props = config.pop('.', None)
|
||||
kwargs = {k: config[k] for k in config if valid_ident(k)}
|
||||
kwargs = {k: config[k] for k in config if (k != '.' and valid_ident(k))}
|
||||
try:
|
||||
result = factory(**kwargs)
|
||||
except TypeError as te:
|
||||
|
@ -854,6 +853,7 @@ class DictConfigurator(BaseConfigurator):
|
|||
result.setLevel(logging._checkLevel(level))
|
||||
if filters:
|
||||
self.add_filters(result, filters)
|
||||
props = config.pop('.', None)
|
||||
if props:
|
||||
for name, value in props.items():
|
||||
setattr(result, name, value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue