[Yum-devel] Making yum quiet - yum.logginglevels.setDebugLevel(0) seemingly not working...

MacCana, Mike (London) mmaccana at maninvestments.com
Thu Jun 11 16:19:47 UTC 2009


On Thu, 11 Jun 2009, MacCana, Mike \(London\) wrote:

> -----Original Message-----
> From: yum-devel-bounces at lists.baseurl.org 
> [mailto:yum-devel-bounces at lists.baseurl.org] On Behalf Of Seth Vidal
> Sent: 11 June 2009 16:19
> To: yum development
> Subject: Re: [Yum-devel] Making yum quiet - yum.logginglevels.setDebugLevel(0) seemingly not working...
>
> On Thu, 11 Jun 2009, MacCana, Mike \(London\) wrote:
>
>>>> Hi folks,
>>>>  
>>>> I'm installing a few packages using yum.YumBase.install in a 
>>>> postinstall. From the module docs, I gather setDebugLevel(0) should be the equivalent of a yum '--quiet', but alas, the following code...

>>> the debuglevel is for for yum cli output callbacks. You're not using
>>> those- so you're getting the default callbacks.

>> Thanks Seth. Is doLoggingSetup() also for the cli only (as I've tried it with the same results)?
>> How can I modify logging levels for API-level access?

> For API level access you really don't set it. You want to make your logging callback do whatever you want it to do.
> -sv

OK, I've had a crack at this borrowing the ProcessTransNoOutputCallback from a while back.

def install():
    class ProcessTransNoOutputCallback:
        def __init__(self):
            pass        
        def event(self,state,data=None):
            pass
    yb = yum.YumBase()
    yb.install(name='zlib-devel')
    yb.resolveDeps()
    yb.processTransaction(callback=ProcessTransNoOutputCallback())
    print('success\n')

install()

This works, but the output's still the same. If the callback handles the logging, and my callback does nothing, then how come this is still happening? I'm quite sure I'm doing something wrong here - the yum API is somewhat low level and is certainly testing my python skills. I could do what I want by using the easier yumbasecli module but I'd rather handle it in the same way other tools do.

Mike

**********************************************************************
Please consider the environment before printing this email or its attachments.
The contents of this email are for the named addressees only.  It contains information which may be confidential and privileged.  If you are not the intended recipient, please notify the sender immediately, destroy this email and any attachments and do not otherwise disclose or use them. Email transmission is not a secure method of communication and Man Investments cannot accept responsibility for the completeness or accuracy of this email or any attachments. Whilst Man Investments makes every effort to keep its network free from viruses, it does not accept responsibility for any computer virus which might be transferred by way of this email or any attachments. This email does not constitute a request, offer, recommendation or solicitation of any kind to buy, subscribe, sell or redeem any investment instruments or to perform other such transactions of any kind. Man Investments reserves the right to monitor, record and retain all electronic communications through its network to ensure the integrity of its systems, for record keeping and regulatory purposes. 
Visit us at: www.maninvestments.com 
TG0908
**********************************************************************



More information about the Yum-devel mailing list