[Python-Dev] Re: PEP 282 comments
Mark Hammond
mhammond@skippinet.com.au
Thu, 21 Mar 2002 12:04:23 +1100
[Trent]
> How about this (just an idea):
> def info(self, msgOrException, *args):
> if isinstance(msgOrException, Exception):
> # format the exception and
> msg, args = args[0], args[1:]
> else:
> # treat it like before
>
> try:
> # ...
> except Exception, ex:
> log.info(ex, "Eeeeek!")
I don't like this. I think it rare you will want to log an exception with
no contextual message.
Eg,
info(sys.exc_info())
Would be pretty useless in a log. You would also want to include *what*
went wrong (whereas the exception generally only tells you *why* (and where)
it went wrong.
Mark.