how to create a log file in python code example
Example 1: create log in python
logging.basicConfig(filename="logfilename.log", level=logging.INFO)
# Log Creation
logging.info('your text goes here')
logging.error('your text goes here')
logging.debug('your text goes here')
Example 2: outputting file logs into text in python
import logging
logging.basicConfig(filename='app.log', filemode='w', format='%(name)s - %(levelname)s - %(message)s')
logging.warning('This will get logged to a file')