[Zope-dev] Re: [Zope-Checkins] SVN: Zope/trunk/lib/python/Products/ZCatalog/ProgressHandler.py added FilelogHandler

Chris Withers chris at simplistix.co.uk
Wed Sep 21 03:12:53 EDT 2005


Is there any way this could use normal python loggers?

logger = getLogger('progress')

?

(and then with a more generic section in zope.conf for having more 
loggers configured...)

Andreas Jung wrote:
> Log message for revision 38482:
>   added FilelogHandler
>   
> 
> Changed:
>   U   Zope/trunk/lib/python/Products/ZCatalog/ProgressHandler.py
> 
> -=-
> Modified: Zope/trunk/lib/python/Products/ZCatalog/ProgressHandler.py
> ===================================================================
> --- Zope/trunk/lib/python/Products/ZCatalog/ProgressHandler.py	2005-09-15 13:22:20 UTC (rev 38481)
> +++ Zope/trunk/lib/python/Products/ZCatalog/ProgressHandler.py	2005-09-16 08:29:14 UTC (rev 38482)
> @@ -95,3 +95,16 @@
>      def output(self, text):
>          LOG(self._ident, INFO, text)
>  
> +
> +class FilelogHandler(StdoutHandler)
> +    """ Use a custom file for logging """
> +
> +    __implements__ = IProgressHandler
> +
> +    def __init__(self, filename, steps=100):
> +        StdoutHandler.__init__(self, steps)
> +        self.filename = filename
> +
> +    def output(self, text):
> +        open(self.filename, 'a').write(text + '\n')
> +
> 
> _______________________________________________
> Zope-Checkins maillist  -  Zope-Checkins at zope.org
> http://mail.zope.org/mailman/listinfo/zope-checkins
> 

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



More information about the Zope-Dev mailing list