[Project] Flask python learning Chapter 1 - 2.0 log blueprint drawn extraction factory function

Log
      Import logging function 

# Set the log record levels 
logging.basicConfig (Level = logging.DEBUG) # debug debug level 
# Create a logger, specify the path to save the log, the maximum size of each log file, save the log file limit the number of 
file_log_handler = RotatingFileHandler ( " logs / log " , MaxBytes = 1024 * 1024 * 100, BACKUPCOUNT = 10 )
 # Create a logging file name format of the log information of the log number of rows level input log information 
Formatter logging.Formatter = ( ' % (levelname) S% (filename) S:% (lineno) D% (Message) S ' )
 # is disposed logger logging format newly created 
file_log_handler.setFormatter (Formatter)
 # global logging tool objects () used in the Add log flask app recorder 
logging.getLogger (). addHandler (file_log_handler)

 

 

To be continued

Guess you like

Origin www.cnblogs.com/oscarli/p/12110747.html