lighter weight options to Python's logging package?

Diez B. Roggisch deets at nospam.web.de
Sat Mar 11 01:53:56 CET 2006


> We've done a bit already.  I will see if there's more we can do.  Our use of
> the package is actually very simple.  All we do are log basic messages.  Our
> Formatter instance includes the time, level and message.  That's it.  We
> have no need for displaying exception info, don't do threads, don't mess
> with the file or module names, etc.  The only thing we do that isn't
> supported directly by the package is to use a compressing version of the
> RotatingFileHandler class.


In java's log4j a common idiom for logging is this:

if(logger.isDebugEnabled()) {
    logger.debug(some_lengthy_calculation());
}


I never tried to employ that in python - but maybe it would help you 
too, as it certainly rids you of all unnecessary processing of messages 
that wouldn't make it anyway.

Diez



More information about the Python-list mailing list