Python built-in logging module

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.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325061727&siteId=291194637