python- network connection module 1- write log -nnlog

import nnlog

log01= nnlog.Logger('test01.log',level='warn',backCount=5,when = 's')  
  Parameter # 1: log path, it may be a non-existent file will automatically be created under the current path 
  # Parameter 2: level: four levels, debug, info, warn, error , debug is the lowest level, will print all information
  # parameter 3: backCount: keep the last few log # 4 parameters: generating a frequency: S- per second; D-day; h-hour

log01.debug ( 'debugging')    # the lowest level - the more content to print - the lowest performance - the development stage with Debug 
log01.info ( 'normal print information')
log01.warning ( 'warning') # Production environment in general print warning or error.
log01.error ( 'error messages') # the highest level - just print an error message, do not print debug information
log01.surprise ()

  # Note: as an argument is warn, as the method is warning.


 

Guess you like

Origin www.cnblogs.com/qxhaxx/p/11787594.html