I've got a python server that was using logging module. So far it was just:
logging.basicConfig(filename='server.log',level=logging.INFO,format='%(asctime)s\t%(levelname)s\t%(message)s')
Now I want to add few handlers to the logger. This is about 15 lines of code. I don't want to put it into the main server.py file to make it hold the most important server stuff. The question is - what is the suggested way to do this in python.
I have moved my logging handlers definitions into another module and have imported it:
import logdefs
but then this import is never used (I never use logdefs.something). Is that ok? Another question is - how does it work that logging module is loaded from a server.py's submodule and all the logging settings are available for the rest of its application (modifications are global instead of local)? Is all logging module content available as some kind of a singleton?