[Python-Dev] Re: PEP 282 comments (original) (raw)

Trent Mick trentm@ActiveState.com
Wed, 20 Mar 2002 18:13:07 -0800


[Vinay Sajip wrote]

> > def logException(self, level, excinfo, msg, *args) > > No need to pass in the excinfo if you are already specifying that an > exception is being logged via logException.

Yes, except that you are assuming (I think) that logException would call sys.excinfo() to get the exception info. what about if the exception info needs to come from somewhere else (e.g. from a pickled message sent over the wire)? I haven't yet thought through all the issues about passing tracebacks etc. across sockets...

Touche, I haven't thought about that either and don't know if I am qualified to determine if that is a common enough case. If it is not that common then (forgetting the 'level'-issue for the moment) you have to admit that:

try:
    ...
except:
    log.exception("My britches are burning!")

sure is a log nicer than

try:
    ...
except:
    log.logException(sys.exc_info(), "My britches are burning!")

Trent

-- Trent Mick TrentM@ActiveState.com