yuppie wrote:
Have a look at MailingLogger's SummarisingLogger for ideas. Give it a go and let me know where the code is if you want me to take a look, I've got to know and love python's logging module quite well ;-)

I had a quick look at MailingLogger, but it seems to do something different.

Well yes, but it's the same technique ;-)

We need 'per request' reports to give instant feedback in the setup tool.

...so instantiate the logger at the start of the request, and remove it at the end...

The logging module is not aware of requests, so I can't see an easy way to make sure the log handler collects only messages for a specific request.

Your code runs in some kind of loop, right?
Put a try: finally: around that loop, add your logger before the try and remove it in the finally :-)

That said, I'm not sure the logging module has a nice api for removing loggers, but I could be wrong...



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

Zope-CMF maillist  -  Zope-CMF@lists.zope.org

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to