[Python-Dev] Using logging in the stdlib and its unit tests
lukasz at langa.pl
Tue Dec 7 22:04:36 CET 2010
Wiadomość napisana przez Antoine Pitrou w dniu 2010-12-07, o godz. 21:50:
> If any library defining a logger must also add a NullHandler just in
> case, ISTM that complicates a lot the use of logging (and could explain
> its impopularity). Both for library writers and application writers,
> apparently (since the former will have to add the NullHandler, and the
> latter will have to override it so that error messages get printed out
> rather than lost).
ISTM that the stdlib is a special case here. 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.
If you're writing a library, well, that depends. Part of libraries might want to have their specific default handlers, part of them might want to leave that to the library user (e.g. "No handlers can be found" by default) and part of them might want to silence logs by default.
One way or the other, we should really default to the convenience of application developers. This is currently the case.
tel. +48 791 080 144
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev