[Zope-CMF] Re: [dev] RFC: logging/reporting framework for
GenericSetup
Chris Withers
chris at simplistix.co.uk
Fri Nov 18 02:47:20 EST 2005
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...
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the Zope-CMF
mailing list