[Python-Dev] Using logging in the stdlib and its unit tests (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Wed Dec 8 10:42:59 CET 2010
- Previous message: [Python-Dev] Using logging in the stdlib and its unit tests
- Next message: [Python-Dev] Using logging in the stdlib and its unit tests
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 08 Dec 2010 09:09:45 +0100 Georg Brandl <g.brandl at gmx.net> wrote:
Am 08.12.2010 01:09, schrieb Antoine Pitrou: > On Tue, 7 Dec 2010 23:45:39 +0000 (UTC) > Vinay Sajip <vinaysajip at yahoo.co.uk> wrote: >> Antoine Pitrou <solipsis pitrou.net> writes: >> >> > >> > I thought "error" and "critical" messages were logged to stderr by >> > default? Isn't it the case? >> > >> >> Only if you call basicConfig() or use the logging.debug(), logging.info(), etc. >> module-level convenience functions (which call basicConfig under the hood). > > Why wouldn't it be the default for all logging calls ? Such special > cases don't really make things easy to remember. > >> When is the NullHandler needed? Only for cases where an application developer >> uses a library which does logging under the covers (for those users who might be >> interested in logging its operations), but where that application developer >> doesn't use logging themselves for that application. > > You seem pretty tied up to the "application developer" situation. There > are cases (scripts, prototyping, etc.) where you certainly want to see > error messages (errors should not pass silently) but don't want to > configure logging for each of the libraries you use.
But errors don't pass silently, do they? The usual way to present errors is still by raising exceptions.
Or logging them. http://docs.python.org/dev/library/logging.html#logging.Logger.exception
- Previous message: [Python-Dev] Using logging in the stdlib and its unit tests
- Next message: [Python-Dev] Using logging in the stdlib and its unit tests
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]