[Tutor] questions about debugging program
gerard henry
gerard.henry at free.fr
Tue Aug 19 21:04:05 EDT 2003
hello,
with your help, i wrote a little module to trace all i want in my program.
My config is:
python 2.2.3
logging module 0.4.7 from Vinay Sajip
i write a little module: debug.py
##################### debug.py #########################################
import logging, logging.handlers # pour logger les messages
logger = logging.getLogger('')
logger.setLevel(logging.DEBUG)
handler_log = logging.FileHandler("LGD.log", 'a')
format = logging.Formatter("%(asctime)s %(filename)s:%(lineno)d
%(levelname)-5s - %(message)s")
handler_log.setFormatter(format)
logger.addHandler(handler_log)
##################### end of debug.py ##################################
and in others modules, i have to add:
import debug
and debug.logger.info(any_data)
it's great, yes, but if i want to suppress this last line, how can i do
to not forget to suppress "import debug" also? in C/C++, i know if
something is not used, and i can lite source code, but how can i do the
same in python? in my 60 files, there is a lot of import, and i m sure
there are not all necessary
thanks for your help
gerard
More information about the Tutor
mailing list