>> I am just curious to know if there is a reason that PyUSB does not set
>> the Logger.propagate field to False for its loggers, or provide that as
>> an option?  It seems like that would be a more expected default, since
>> PyUSB logs errors for expected cases (certain driver backends not being
>> found).
>>
> 
> To be sincere, I was not aware of this attribute. It sounds much
> better than the hack I provided. I have only one question: if I
> configure it to False, is the value inherited by the child loggers?

I'm not an expert on the logging module, but I believe the propagate
attribute is not inherited by children.

I actually found that it's pretty easy to just manually set this, since
the logging module uses singletons:

----
    log = logging.getLogger('usb')
    log.propagate = False
----

I do that in my application and it allows us to use the root logger
without any USB chatter.

The only drawback to this method is that it does depend on the 'usb'
string.  I think a class method like usb.core.getLoggerName() that
returns 'usb' would be a nice way to alleviate the dependency on another
module's built-in strings.

Thanks,

-Trevor

-- 
Trevor Bentley
Sherpa Solutions, LLC

Office: (404)467-8866
Web: http://www.sherpasolutions.net/


------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to