[issue15541] logging.exception doesn't accept 'extra'

Ned Batchelder report at bugs.python.org
Thu Aug 2 23:52:13 CEST 2012


New submission from Ned Batchelder:

The logging.exception method differs from .debug(), .info(), .warning(), .error() and .critical() in that it does not accept an `extra` keyword argument.  There seems to be no reason for this.

The docs are misleading about this. They say, "The arguments are interpreted as for debug()."

Changing exception() to this would take care of it::

    def exception(self, msg, *args, **kwargs):
        """
        Convenience method for logging an ERROR with exception information.
        """
        kwargs['exc_info'] = 1
        self.error(msg, *args, **kwargs)

----------
components: Library (Lib)
messages: 167260
nosy: nedbat
priority: normal
severity: normal
status: open
title: logging.exception doesn't accept 'extra'
type: behavior
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15541>
_______________________________________


More information about the Python-bugs-list mailing list