diff options
author | Kaundur <kaundur@protonmail.com> | 2024-06-04 11:48:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-04 11:48:05 (GMT) |
commit | dce14bb2dce7887df40ae5c13b0d13e0dafceff7 (patch) | |
tree | 0b785f5cc4f04ae181f65979dd8a941eccc1f67e /Lib/logging | |
parent | 9e052619a6d32051394444c24d3185db1735a893 (diff) | |
download | cpython-dce14bb2dce7887df40ae5c13b0d13e0dafceff7.zip cpython-dce14bb2dce7887df40ae5c13b0d13e0dafceff7.tar.gz cpython-dce14bb2dce7887df40ae5c13b0d13e0dafceff7.tar.bz2 |
gh-118868: logging QueueHandler fix passing of kwargs (GH-118869)
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/config.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py index 860e475..ac45d68 100644 --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -725,16 +725,16 @@ class DictConfigurator(BaseConfigurator): def _configure_queue_handler(self, klass, **kwargs): if 'queue' in kwargs: - q = kwargs['queue'] + q = kwargs.pop('queue') else: q = queue.Queue() # unbounded - rhl = kwargs.get('respect_handler_level', False) - if 'listener' in kwargs: - lklass = kwargs['listener'] - else: - lklass = logging.handlers.QueueListener - listener = lklass(q, *kwargs.get('handlers', []), respect_handler_level=rhl) - handler = klass(q) + + rhl = kwargs.pop('respect_handler_level', False) + lklass = kwargs.pop('listener', logging.handlers.QueueListener) + handlers = kwargs.pop('handlers', []) + + listener = lklass(q, *handlers, respect_handler_level=rhl) + handler = klass(q, **kwargs) handler.listener = listener return handler |