mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-115032: Deprecate support for custom logging handlers with 'strm' argument. (GH-115314)
This commit is contained in:
parent
355ee1a429
commit
28a2fd031e
4 changed files with 59 additions and 0 deletions
|
@ -865,6 +865,8 @@ class DictConfigurator(BaseConfigurator):
|
|||
else:
|
||||
factory = klass
|
||||
kwargs = {k: config[k] for k in config if (k != '.' and valid_ident(k))}
|
||||
# When deprecation ends for using the 'strm' parameter, remove the
|
||||
# "except TypeError ..."
|
||||
try:
|
||||
result = factory(**kwargs)
|
||||
except TypeError as te:
|
||||
|
@ -876,6 +878,15 @@ class DictConfigurator(BaseConfigurator):
|
|||
#(e.g. by Django)
|
||||
kwargs['strm'] = kwargs.pop('stream')
|
||||
result = factory(**kwargs)
|
||||
|
||||
import warnings
|
||||
warnings.warn(
|
||||
"Support for custom logging handlers with the 'strm' argument "
|
||||
"is deprecated and scheduled for removal in Python 3.16. "
|
||||
"Define handlers with the 'stream' argument instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
if formatter:
|
||||
result.setFormatter(formatter)
|
||||
if level is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue