[Zope-CMF] Re: [dev] RFC: logging/reporting framework for
GenericSetup
yuppie
y.2005- at wcm-solutions.de
Thu Nov 17 07:39:53 EST 2005
Hi Tres!
Tres Seaver wrote:
>> Hmm, it seems like that landed in the project-local repository from
>> which GenericSetup originally sprang, but *after* GenericSetup landed in
>> CMF's repository. I'm attaching the patch:
>>
>> - It uses the '_notes' field both to create an OFS.Image.File log of
>> import runs, as well as to display at the bottom of the "Import"
>> tab.
>>
>> - It echoes logged messages to zLOG.
>>
>> - It expands ISetupContext's API with methods 'note', 'listNotes',
>> and 'clearNotes'. Stock implementations of ths API are in a new
>> 'SetupContextBase' class.
>>
>> Note that the patch doesn't apply cleanly to the GenericSetup trunk;
>> I'll have to work out why if we chose to land it.
>
> OK, I've landed it (it was easier than I expected) on a new branch:
>
> http://svn.zope.org/CMF/branches/tseaver-resync_GenericSetup
I tried hard to make the I/O adapters reusable outside GenericSetup. To
become more independent from ISetupContext I propose to move the logging
API into a separate interface and class. ISetupContext would just have a
getLogger() method.
I'm also missing different logging levels. The python logging module has
a nice generic API for that.
So I propose to use the same interface for the GenericSetup specific
logger, making it replaceable by a python logger if the I/O handlers are
used in a different context.
For example this code in content.py::
import_context.note('SGAIFA',
'no .ini file for %s/%s' % (subdir, cid))
would be replaced by this code::
logger = import_context.getLogger('SGAIFA')
logger.info('no .ini file for %s/%s' % (subdir, cid))
If there are no objections I'd like to make those changes either on your
branch or after you merged your changes into the trunk.
Cheers,
Yuppie
More information about the Zope-CMF
mailing list