pungi logger

Joel Andres Granados jgranado at redhat.com
Mon Jun 11 17:01:26 UTC 2007


Jesse Keating wrote:
> On Tuesday 15 May 2007 14:20:29 Jesse Keating wrote:
>   
>> On Friday 04 May 2007 10:13:34 Joel Andres Granados wrote:
>>     
>>> Referring to ticket #34 at
>>> https://hosted.fedoraproject.org/projects/pungi/ticket/34 stating that
>>> the logger needed a little work so that it didn't depend on the
>>> gather.py (or at least thats what I understood :)  I propose either a
>>> new file (pungiLog.py) located in the pypungi directory or a new
>>> function in the "pungi" file that contains the logging stuff.  The log
>>> services would be started somewhere before the line containing "#
>>> Actually do work." of the "pungi" file.  The logging root would be
>>> called "pungi" and would be called in each file that logging is needed
>>> with the logging.getlogger("pungi") command.
>>> If "quiet" is specified in the config file the logging will be turned
>>> off.
>>>
>>> *Diff for the pungi file:*
>>> 1. Initializes the logger by calling to the new file.
>>> 2. specify quiet value.
>>> 3.  logging function.
>>> *
>>> Diff for pungi.py file:
>>> *1. use the correct logger.
>>> *
>>> Diff for gather.py file:*
>>> change all the if statements for each logging call.
>>>
>>> Files attached...
>>> Comments appreciated.
>>>       
>> Thanks for this.  I think this is the right direction.  However I'm
>> reluctant to make such a change this late in Fedora 7 development.  I'll
>> want to look at this once I start doing Fedora 8 changes.
>>     
>
> I just looked at this again and I don't think it'll quite work.  The thing is 
> I want logging to work if somebody just imported pypungi and started using 
> commands.  Maybe that's not possible, maybe it is.  Something to look into.  
> I think I can have a pypungi.logger module/class that has some reasonable 
> defaults that can be overridden if the config file is used, or if 
> say /usr/bin/pungi is envoked, but would work otherwise.
>
>   
> ------------------------------------------------------------------------
>
> --
> Fedora-buildsys-list mailing list
> Fedora-buildsys-list at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-buildsys-list
Something like this???
The logger must still be initialized, but after that you just have to 
import the Plog variable from pypungi to begin.  I put the logging code 
in the __init__.py because I wanted it to execute when "import pypungi" 
was called.  I couldn't find a way to pass arguments to it though 
(within python).  It would be ideal to set global variables before the 
import and for the function to somehow notice those globals.  I would 
suppose it is possible but have no idea how.  Look for more info on that 
tomorrow.

For now here is my proposal :)
Comments greatly appreciated :)

Regards


-- 
Joel Andres Granados

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff
URL: <http://listman.redhat.com/archives/fedora-buildsys-list/attachments/20070611/13aae2d2/attachment.ksh>


More information about the Fedora-buildsys-list mailing list