[Python-Dev] Using logging in the stdlib and its unit tests (original) (raw)

Vinay Sajip vinay_sajip at yahoo.co.uk
Wed Dec 8 01:01:25 CET 2010


Barry Warsaw <barry python.org> writes:

On Dec 07, 2010, at 04:59 PM, Robert Kern wrote: >As a library author, I would dearly love to just add logging liberally >without placing any additional burden to the users of my library. If my users >wants to read those logs, he will configure logging. If he doesn't, he >won't. With the current behavior, I can't do that. If I add logging, he has >to add code just to silence a message that is meaningless to him (after I get >the support emails asking if things are broken and explain how to silence >it). If I add a NullHandler, I remove the ability for him to use >logging.basicConfig(), the easiest and most straightforward way for him to >add logging to his application. +1

Barry, if you mean +1 as in "I agree this is how it should work", then we're all agreed. But I think Robert is wrong that NullHandler precludes use of basicConfig - when NullHandler is added to a library logger (rather than the root logger), basicConfig() works as expected. See the mylib/myapp example in my other post on this thread.

Regards,

Vinay Sajip



More information about the Python-Dev mailing list