Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
04d5bc00
Commit
04d5bc00
authored
Oct 21, 2011
by
Vinay Sajip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Closes #13235: Added deprecation for warn() methods and function in logging.
parent
ac65d967
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
5 deletions
+23
-5
Doc/library/logging.rst
Doc/library/logging.rst
+9
-2
Lib/logging/__init__.py
Lib/logging/__init__.py
+12
-3
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Doc/library/logging.rst
View file @
04d5bc00
...
...
@@ -189,6 +189,9 @@ instantiated directly, but always through the module-level function
Logs a message with level :const:`WARNING` on this logger. The arguments are
interpreted as for :meth:`debug`.
.. note:: There is an obsolete method `warn()` which is functionally
identical to `warning()`. As `warn()` is deprecated, please do not use
it - use `warning()` instead.
.. method:: Logger.error(msg, *args, **kwargs)
...
...
@@ -880,8 +883,12 @@ functions.
.. function:: warning(msg, *args, **kwargs)
Logs a message with level :const:`WARNING` on the root logger. The arguments are
interpreted as for :func:`debug`.
Logs a message with level :const:`WARNING` on the root logger. The arguments
are interpreted as for :func:`debug`.
.. note:: There is an obsolete function `warn()` which is functionally
identical to `warning()`. As `warn()` is deprecated, please do not use
it - use `warning()` instead.
.. function:: error(msg, *args, **kwargs)
...
...
Lib/logging/__init__.py
View file @
04d5bc00
...
...
@@ -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
):
"""
...
...
Misc/NEWS
View file @
04d5bc00
...
...
@@ -326,6 +326,8 @@ Core and Builtins
Library
-------
- Issue #13235: Added PendingDeprecationWarning to warn() method and function.
- Issue #9168: now smtpd is able to bind privileged port.
- Issue #12529: fix cgi.parse_header issue on strings with double-quotes and
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment