Python Logging across multiple classes and files; how to configure so as to be easily disabled?
Posted
by mellort
on Stack Overflow
See other posts from Stack Overflow
or by mellort
Published on 2010-06-18T14:13:38Z
Indexed on
2010/06/18
14:53 UTC
Read the original article
Hit count: 195
Currently, I have osmething like this in all of my classes:
# Import logging to log information
import logging
# Set up the logger
LOG_FILENAME = 'log.txt'
logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
This works well, and I get the output I want, but I would really like to have all this sort of information in one place, and be able to just do something like import myLogger
and then start logging, and then hopefully be able to just go into that file and turn off logging when I need an extra performance boost.
Thanks in advance
© Stack Overflow or respective owner