Ed Leafe <e...@...> writes:

> 
> On Sep 13, 2010, at 10:59 AM, Ed Leafe wrote:
> 
> >> 2. Did you have to do anything which you thought of as a workaround due to
> >> some limitation of the logging package?
> 
> I wanted to create default loggers that write to files, but set them by
> default to not do anything. This should be possible by setting the default
> output file to os.devnull, but we found its behavior on Windows inconsistent,
> so I turned off file logging.
> 
> Oh, I should mention that I did try the NullHandler approach (killing the
> emit() method), but it seemed messier than just turning file logging off.
> 

A library should not do any logging by default, as it will not necessarily be
wanted or expected by a library user. However, if a library contains logging
calls and the library user doesn't configure any logging, then a one-off
misconfiguration warning message is output when no handlers are found to handle
a logged event. The purpose of NullHandler is to avoid this warning message:
since a handler is found, no warning message is output, but as the NullHandler
swallows everything, nothing is actually logged.

A user of Dabo can configure logging however they want, adding whatever handlers
they want, and Dabo logging messages will be output along with the rest. You can
specify a default logging level for the Dabo top-level logger (which would
inherit the normal default of WARNING) if you wanted Dabo messages to have a
different default verbosity.

Thanks for the response,

Vinay Sajip


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to