mirror of https://github.com/python/cpython
gh-105376: Remove logging.warn() and LoggerAdapter.warn() (#106553)
This commit is contained in:
parent
da98ed0aa0
commit
dcc028d924
|
@ -1015,6 +1015,10 @@ interchangeably.
|
||||||
Attribute :attr:`manager` and method :meth:`_log` were added, which
|
Attribute :attr:`manager` and method :meth:`_log` were added, which
|
||||||
delegate to the underlying logger and allow adapters to be nested.
|
delegate to the underlying logger and allow adapters to be nested.
|
||||||
|
|
||||||
|
.. versionchanged:: 3.13
|
||||||
|
Remove the undocumented ``warn()`` method which was an alias to the
|
||||||
|
``warning()`` method.
|
||||||
|
|
||||||
|
|
||||||
Thread Safety
|
Thread Safety
|
||||||
-------------
|
-------------
|
||||||
|
@ -1162,6 +1166,10 @@ functions.
|
||||||
identical to ``warning``. As ``warn`` is deprecated, please do not use
|
identical to ``warning``. As ``warn`` is deprecated, please do not use
|
||||||
it - use ``warning`` instead.
|
it - use ``warning`` instead.
|
||||||
|
|
||||||
|
.. versionchanged:: 3.13
|
||||||
|
Remove the undocumented ``warn()`` function which was an alias to the
|
||||||
|
:func:`warning` function.
|
||||||
|
|
||||||
|
|
||||||
.. function:: error(msg, *args, **kwargs)
|
.. function:: error(msg, *args, **kwargs)
|
||||||
|
|
||||||
|
|
|
@ -348,10 +348,11 @@ Removed
|
||||||
use ``locale.setlocale(locale.LC_ALL, "")`` instead.
|
use ``locale.setlocale(locale.LC_ALL, "")`` instead.
|
||||||
(Contributed by Victor Stinner in :gh:`104783`.)
|
(Contributed by Victor Stinner in :gh:`104783`.)
|
||||||
|
|
||||||
* Remove the undocumented and untested ``logging.Logger.warn()`` method,
|
* :mod:`logging`: Remove undocumented and untested ``Logger.warn()`` and
|
||||||
deprecated since Python 3.3, which was an alias to the
|
``LoggerAdapter.warn()`` methods and ``logging.warn()`` function. Deprecated
|
||||||
:meth:`logging.Logger.warning` method: use the :meth:`logging.Logger.warning`
|
since Python 3.3, they were aliases to the :meth:`logging.Logger.warning`
|
||||||
method instead.
|
method, :meth:`!logging.LoggerAdapter.warning` method and
|
||||||
|
:func:`logging.warning` function.
|
||||||
(Contributed by Victor Stinner in :gh:`105376`.)
|
(Contributed by Victor Stinner in :gh:`105376`.)
|
||||||
|
|
||||||
* Remove *cafile*, *capath* and *cadefault* parameters of the
|
* Remove *cafile*, *capath* and *cadefault* parameters of the
|
||||||
|
|
|
@ -37,7 +37,7 @@ __all__ = ['BASIC_FORMAT', 'BufferingFormatter', 'CRITICAL', 'DEBUG', 'ERROR',
|
||||||
'captureWarnings', 'critical', 'debug', 'disable', 'error',
|
'captureWarnings', 'critical', 'debug', 'disable', 'error',
|
||||||
'exception', 'fatal', 'getLevelName', 'getLogger', 'getLoggerClass',
|
'exception', 'fatal', 'getLevelName', 'getLogger', 'getLoggerClass',
|
||||||
'info', 'log', 'makeLogRecord', 'setLoggerClass', 'shutdown',
|
'info', 'log', 'makeLogRecord', 'setLoggerClass', 'shutdown',
|
||||||
'warn', 'warning', 'getLogRecordFactory', 'setLogRecordFactory',
|
'warning', 'getLogRecordFactory', 'setLogRecordFactory',
|
||||||
'lastResort', 'raiseExceptions', 'getLevelNamesMapping',
|
'lastResort', 'raiseExceptions', 'getLevelNamesMapping',
|
||||||
'getHandlerByName', 'getHandlerNames']
|
'getHandlerByName', 'getHandlerNames']
|
||||||
|
|
||||||
|
@ -1928,11 +1928,6 @@ class LoggerAdapter(object):
|
||||||
"""
|
"""
|
||||||
self.log(WARNING, msg, *args, **kwargs)
|
self.log(WARNING, msg, *args, **kwargs)
|
||||||
|
|
||||||
def warn(self, msg, *args, **kwargs):
|
|
||||||
warnings.warn("The 'warn' method is deprecated, "
|
|
||||||
"use 'warning' instead", DeprecationWarning, 2)
|
|
||||||
self.warning(msg, *args, **kwargs)
|
|
||||||
|
|
||||||
def error(self, msg, *args, **kwargs):
|
def error(self, msg, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Delegate an error call to the underlying logger.
|
Delegate an error call to the underlying logger.
|
||||||
|
@ -2206,11 +2201,6 @@ def warning(msg, *args, **kwargs):
|
||||||
basicConfig()
|
basicConfig()
|
||||||
root.warning(msg, *args, **kwargs)
|
root.warning(msg, *args, **kwargs)
|
||||||
|
|
||||||
def warn(msg, *args, **kwargs):
|
|
||||||
warnings.warn("The 'warn' function is deprecated, "
|
|
||||||
"use 'warning' instead", DeprecationWarning, 2)
|
|
||||||
warning(msg, *args, **kwargs)
|
|
||||||
|
|
||||||
def info(msg, *args, **kwargs):
|
def info(msg, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Log a message with severity 'INFO' on the root logger. If the logger has
|
Log a message with severity 'INFO' on the root logger. If the logger has
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
Remove the undocumented and untested ``logging.Logger.warn()`` method,
|
:mod:`logging`: Remove undocumented and untested ``Logger.warn()`` and
|
||||||
deprecated since Python 3.3, which was an alias to the
|
``LoggerAdapter.warn()`` methods and ``logging.warn()`` function. Deprecated
|
||||||
:meth:`logging.Logger.warning` method: use the :meth:`logging.Logger.warning`
|
since Python 3.3, they were aliases to the :meth:`logging.Logger.warning`
|
||||||
method instead. Patch by Victor Stinner.
|
method, :meth:`!logging.LoggerAdapter.warning` method and
|
||||||
|
:func:`logging.warning` function. Patch by Victor Stinner.
|
||||||
|
|
Loading…
Reference in New Issue