Recently, I have been debugging Python code a lot, and I found that the logging module is very useful.
My usage is as follows:
import logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(filename)s [line: %(lineno)d] - %(message)s') #logging.disable(logging.CRITICAL) logging.info('your message')
Just remove the # in the code when you need to uncomment it.