Topic starter 09/12/2021 4:17 pm
How to create a log file in Python script?
Topic starter 09/12/2021 4:20 pm
You can use the logging module to accomplish this.
import logging
At the very easiest level, it will be set up like this:
logging.basicConfig(filename="mytechmint-logfile.log", level=logging.INFO)
There are a number of different levels that you can use to write to the file, such as:
logging.info('your text goes here') logging.error('your text goes here') logging.debug('your text goes here')