diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2014-09-14 20:29:11 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2014-09-14 20:29:11 (GMT) |
commit | 02a8f9e9acbe55efcbb7ebc3f821d3d2f9cca368 (patch) | |
tree | 842346c95aa2afded7bcf6a5a9171448c62b64c2 /Doc/library/logging.rst | |
parent | 4ff91eb5e38517222ab4e65c1f9d0757c29cebc7 (diff) | |
download | cpython-02a8f9e9acbe55efcbb7ebc3f821d3d2f9cca368.zip cpython-02a8f9e9acbe55efcbb7ebc3f821d3d2f9cca368.tar.gz cpython-02a8f9e9acbe55efcbb7ebc3f821d3d2f9cca368.tar.bz2 |
Closes #20537: logging methods now accept an exception instance as well as a Boolean value or exception tuple. Thanks to Yury Selivanov for the patch.
Diffstat (limited to 'Doc/library/logging.rst')
-rw-r--r-- | Doc/library/logging.rst | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst index 9983711..d0e2c27 100644 --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -155,11 +155,13 @@ is the module's name in the Python package namespace. *msg* using the string formatting operator. (Note that this means that you can use keywords in the format string, together with a single dictionary argument.) - There are three keyword arguments in *kwargs* which are inspected: *exc_info* - which, if it does not evaluate as false, causes exception information to be + There are three keyword arguments in *kwargs* which are inspected: + *exc_info*, *stack_info*, and *extra*. + + If *exc_info* does not evaluate as false, it causes exception information to be added to the logging message. If an exception tuple (in the format returned by - :func:`sys.exc_info`) is provided, it is used; otherwise, :func:`sys.exc_info` - is called to get the exception information. + :func:`sys.exc_info`) or an exception instance is provided, it is used; + otherwise, :func:`sys.exc_info` is called to get the exception information. The second optional keyword argument is *stack_info*, which defaults to ``False``. If true, stack information is added to the logging @@ -216,6 +218,9 @@ is the module's name in the Python package namespace. .. versionadded:: 3.2 The *stack_info* parameter was added. + .. versionchanged:: 3.5 + The *exc_info* parameter can now accept exception instances. + .. method:: Logger.info(msg, *args, **kwargs) |