[Python-Dev] Re: logging exceptions

Jeremy Hylton jeremy at alum.mit.edu
Fri Feb 20 14:45:32 EST 2004


On Thu, 2004-02-19 at 19:25, Vinay Sajip wrote:
> I propose to make the following change:
>      def _log(self, level, msg, args, exc_info=None):
>          # ...
>          if exc_info:
>            if type(exc_info) != types.TupleType:
>              exc_info = sys.exc_info()
>          record = self.makeRecord(self.name, level, fn, lno, msg, args,
> exc_info)
>          self.handle(record)
> 
> This should allow passing an exception tuple in the exc_info parameter - in
> which case, that's used instead of calling sys.exc_info(). It is a slight
> change to the semantics but I can't think of any (non-pathological) code
> which will break. Can anyone see any problems with this approach?

It will work for me.

I suppose we could worry about someone have some iterable other than a
tuple containing the exc_info, but I think that's even more obscure that
my use case of wanting to pass the exc_info tuple.  It doesn't make
sense to store a heterogenous record in a list.

Jeremy





More information about the Python-Dev mailing list