11-LOG/01.py /

 

 

import logging
   
  LOG_FORMAT = "%(asctime)s=====%(levelname)s++++++%(message)s"
   
  logging.basicConfig(filename="tulingxueyuan.log", level=logging.DEBUG, format=LOG_FORMAT)
   
  logging.debug("This is a debug log.")
  logging.info("This is a info log.")
  logging.warning("This is a warning log.")
  logging.error("This is a error log.")
  logging.critical("This is a critical log.")
   
   
   
   
   
  # 另外一种写法
  logging.log(logging.DEBUG, "This is a debug log.")
  logging.log(logging.INFO, "This is a info log.")
  logging.log(logging.WARNING, "This is a warning log.")
  logging.log(logging.ERROR, "This is a error log.")
  logging.log(logging.CRITICAL, "This is a critical log.")
posted @ 2021-03-31 15:42  icy欢仔  阅读(40)  评论(0编辑  收藏  举报