(original) (raw)
Wiadomość napisana przez Antoine Pitrou w dniu 2010-12-07, o godz. 22:19:
If you're writing an application then the "No handlers could be found" message is actually useful because there's hardly any reason no to include one.
Why do you say that? Not having to add a handler is certainly useful
when you are doing some quick prototyping or simply writing a script
(situations in which you still want to get error messages displayed
properly by the libraries).One way or the other, we should really default to the convenience of application developers. This is currently the case.
Why wouldn't there be a default convenience of printing out errors?
It's already the case for the root handler, so why would other handler
be treated differently?import logginglogging.debug("foo")ERROR:root:barlogging.error("bar")
If you're arguing that instead of writing "No handler", our logging library could just as easily default to a simplistic stderr handler for errors, then I agree. Both the convenience and consistency arguments you provided are convincing. See, that was 3 times a con\* in one sentence!
Then again, warning an application developer that some handler is not configured that probably should be, is still valuable IMHO. Unless explicitly silenced.