diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2012-08-04 23:40:21 +0100 |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2012-08-04 23:40:21 +0100 |
commit | 947f358a069c9141c0230e440ab5cba07df0f87f (patch) | |
tree | 3cb444d647ea30e94c64a10e8969104bc44b0a47 /Lib/logging | |
parent | 8ba844ac146dfb06700ae0106938614255108f36 (diff) | |
download | cpython-git-947f358a069c9141c0230e440ab5cba07df0f87f.tar.gz |
Issue #15541: Correct anomaly in logging.exception. Thanks to Ned Batchelder for the report.
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/__init__.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index d214aabbcc..1ae531f338 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1173,11 +1173,12 @@ class Logger(Filterer): if self.isEnabledFor(ERROR): self._log(ERROR, msg, args, **kwargs) - def exception(self, msg, *args): + def exception(self, msg, *args, **kwargs): """ Convenience method for logging an ERROR with exception information. """ - self.error(msg, exc_info=1, *args) + kwargs['exc_info'] = 1 + self.error(msg, *args, **kwargs) def critical(self, msg, *args, **kwargs): """ @@ -1582,12 +1583,13 @@ def error(msg, *args, **kwargs): basicConfig() root.error(msg, *args, **kwargs) -def exception(msg, *args): +def exception(msg, *args, **kwargs): """ Log a message with severity 'ERROR' on the root logger, with exception information. """ - error(msg, exc_info=1, *args) + kwargs['exc_info'] = 1 + error(msg, *args, **kwargs) def warning(msg, *args, **kwargs): """ |