日志相关概念 用来记录程序中 重要的消息 作用程序调试
以下为经常出错的几种类型
import logging
log_format='%(asctime)s %(levelname)s %(message)s'
date_format='%y-%m-%d %H:%M:%S %p'
logging.basicConfig(level=logging.DEBUG,
filename='my_log1',
format=log_format,
datefmt=date_format)
logging.debug('%s is %d year old','tom',10)
logging.info('this is a info')
logging.warning('this is a warning')
logging.error('this is a error')
logging.critical('this is a critical')