[Python-Dev] PEP282 and the warnings framework

Guido van Rossum guido@python.org
Wed, 15 May 2002 11:52:05 -0400


[me]
> > IMO the goals of logging and the warnings framework are quite
> > different: the warnings framework is for the benefit of the
> > *programmer*, while the logging framework is for the benefit of the
> > *end user*.

[Holger]
> Is this true? e.g. Debug/Warning messages are probably meant 
> for developers while Errors/FatalErrors *may* be directed 
> to the end-user.  To whom (programmer/'enduser'/other program) 
> and how messages are routed is a matter of configuration IMO.

You have a point there.  I still think they are relevant at different
stages of development though.  Having just gone through the pain of
debugging a largeish distributed application, language warnings are
something you deal with immediately during unit testing (I treat them
the same as SyntaxErrors), while the logging framework comes into play
during functional testing.

> while merging the two APIs is probably not right
> the warning-module might well be a 'user' of the 
> logging-module.

Good point.  You can easily do this: the function
warnings.showwarning() is a hook that you are allowed to replace.

> I like Gerhard's basic suggestion of filtering on types of 
> classes rather than some fixed integers. But this should
> be commented by the PEP282-authors. 

--Guido van Rossum (home page: http://www.python.org/~guido/)