[Python-Dev] distutils & stderr
Trent Mick
trentm@ActiveState.com
Fri, 1 Feb 2002 10:20:50 -0800
On Fri, Feb 01, 2002 at 10:48:22AM -0500, Guido van Rossum wrote:
> I could see three levels at most:
>
> - verbose, tells you about everything it could do
> - default, only tells you about things it does and not about things it
> skips
> - quiet, only tells you about errors
FYI,
The log4j (j==Java) system uses five levels:
1. debug
2. info
3. warn
4. error
5. fatal
Application code uses the system something like this (simplified Python
translation):
# Go through some steps to get a "Logger" singleton object.
import log4py
log = log4py.getLogger("distutils")
# Then you call methods on the 'log' object for the level of message to
# write.
log.debug("Distutil *could* do BAR.")
...
log.info("Distutils is now doing FOO")
...
log.warn("Beware, SPAM may not be what you expect.")
...
log.error("This is just wrong.")
...
log.fatal("This is really bad. Aborting EGGS.")
# The 'log' object knows if, say, log.debug() calls should actually
# result in any output (because the setup.py option processing sets the
# level to print). So, if I use 'python setup.py -q' the print level is
# set to "WARN" (or perhaps "ERROR") and only .warn(), .error(), and
# .fatal() calls get printed.
That is just an idea of how it could be done. You could reduce the logging
levels down to three, as Guido suggested.
c.f. http://jakarta.apache.org/log4j/docs/index.html
Cheers,
Trent
--
Trent Mick
TrentM@ActiveState.com