diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-10-21 06:33:42 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-10-21 06:33:42 (GMT) |
commit | 04d5bc00a219860c69ea17eaa633d3ab9917409f (patch) | |
tree | 951bae5de7e88f2963ac9156f5836f10aa7d2f62 /Lib/logging | |
parent | ac65d96777f1619c2910de82093e4f6f24dedd2f (diff) | |
download | cpython-04d5bc00a219860c69ea17eaa633d3ab9917409f.zip cpython-04d5bc00a219860c69ea17eaa633d3ab9917409f.tar.gz cpython-04d5bc00a219860c69ea17eaa633d3ab9917409f.tar.bz2 |
Closes #13235: Added deprecation for warn() methods and function in logging.
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/__init__.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 8406df3..6e0394f 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1243,7 +1243,10 @@ class Logger(Filterer): if self.isEnabledFor(WARNING): self._log(WARNING, msg, args, **kwargs) - warn = warning + def warn(self, msg, *args, **kwargs): + warnings.warn("The 'warn' method is deprecated, " + "use 'warning' instead", PendingDeprecationWarning, 2) + self.warning(msg, *args, **kwargs) def error(self, msg, *args, **kwargs): """ @@ -1556,7 +1559,10 @@ class LoggerAdapter(object): """ self.log(WARNING, msg, *args, **kwargs) - warn = warning + def warn(self, msg, *args, **kwargs): + warnings.warn("The 'warn' method is deprecated, " + "use 'warning' instead", PendingDeprecationWarning, 2) + self.warning(msg, *args, **kwargs) def error(self, msg, *args, **kwargs): """ @@ -1766,7 +1772,10 @@ def warning(msg, *args, **kwargs): basicConfig() root.warning(msg, *args, **kwargs) -warn = warning +def warn(msg, *args, **kwargs): + warnings.warn("The 'warn' function is deprecated, " + "use 'warning' instead", PendingDeprecationWarning, 2) + warning(msg, *args, **kwargs) def info(msg, *args, **kwargs): """ |