[Zope] Cool monkey patch to make tracebacks more useful :-)

Chris Withers chris at simplistix.co.uk
Fri Jul 15 15:33:40 EDT 2005


Dieter Maurer wrote:
> I had a similar experience but solved it by modifying
> "zLOG.EventLogger.log" in the following way:
> 
> # DM 2005-06-27: Zope style tracebacks
> from zExceptions.ExceptionFormatter import format_exception
> ....
>         # DM 2005-06-27: we now use Zope's traceback format because
>         #  it is more informative
>         #self.logger.log(level, msg, exc_info=(error is not None))
>         exc_class = sys.exc_info()[0]
>         if error and exc_class is not None: # Note: "error" is a boolean!
>             msg += '\n' + ''.join(format_exception(*sys.exc_info()))
>         self.logger.log(level, msg)

I like this one too :-)

That just leaves the traceback printed by pdb, anyone reckon they can 
get that to use the sensible formatter? ;-)

> Maybe, code like this should move into the Zope core?

*shrugs* I'm quite happy with it as a product that I can add and remove 
as required...

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk



More information about the Zope mailing list