Skip to content

Commit b97fe09

Browse files
pfalcondpgeorge
authored andcommitted
logging: Add exc() and exception() methods.
Non-standard exc() method accepts exception instance to log as a parameter. exception() just uses sys.exc_info().
1 parent 09c59c4 commit b97fe09

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

logging/logging.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ def error(self, msg, *args):
5959
def critical(self, msg, *args):
6060
self.log(CRITICAL, msg, *args)
6161

62+
def exc(self, e, msg, *args):
63+
self.log(ERROR, msg, *args)
64+
sys.print_exception(e, _stream)
65+
66+
def exception(self, msg, *args):
67+
self.exc(sys.exc_info()[1], msg, *args)
68+
6269

6370
_level = INFO
6471
_loggers = {}

0 commit comments

Comments
 (0)