bothans-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bothans-dev] Howto: Using the logging framework


From: mrasschaert
Subject: [bothans-dev] Howto: Using the logging framework
Date: Tue, 8 Apr 2003 16:59:58 +0200

After a few tests I found what i think is good practice concerning the 
logging framework mentionned in another thread.

For each file (module or program) you want to use the logging framework 
you should insert something like this near the beginning of the file : 

import logging
log = logging.getLogger("SensibleName")
log.setLevel(logging.DEBUG)

logging.DEBUG could be logging.INFO, logging.WARN, logging.ERROR or 
logging.CRITICAL

in the file you use the methods log.debug(msg) , log.info ,etc... to log 
messages.

You can use format strings like

log.debug("Hello my name is %s","Michel") to make messages more specific.

--
Michel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]