logging - how to use in a library?

Thomas Heller theller at python.net
Fri Aug 29 18:02:52 EDT 2008


Vinay Sajip schrieb:
> On Aug 27, 11:28 am, Thomas Heller <thel... at python.net> wrote:
>>
>> I came up with a workaround that seems to do what I want.  I add a NULL handler
>> to my top-level logger which is not the root logger but a logger named 'comtypes',
>> other loggers are named 'comtypes.something...'.  So the application developer
>> using the library will not see any comtypes logger messages at all, unless
>> he calls 'logging.basicConfig()', for example.
>>
> 
> This is a good solution - I'll add this as a suggestion in the
> documentation.

Cool.

BTW:  Let me say that the more I use logging the more I like it.
logging is a fantastic package!

Thanks,
Thomas



More information about the Python-list mailing list