[Python-Dev] PEP282 and the warnings framework

holger krekel pyth@devel.trillke.net
Wed, 15 May 2002 17:43:18 +0200


Guido van Rossum wrote:
> > I've reread PEP 282 (the logging PEP) and much of what I read
> > reminded me of the warning framework.
> > 
> > Both systems are responsible for reporting (or ignoring) messages.
> > Both associate messages with locations in the source where the
> > messages originated and both have a way to configure what to report
> > and what to ignore.
> > 
> > So I guess it would make sense to somehow merge the two APIs.
> 
> What follows doesn't really seem to *merge* the two APIs, it just
> picks a clever trick used by the warnings framework and applies it to
> the logging API.
> ...
> 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*.

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.

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

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. 

regards,

    holger