打印python日志的两种方法

这是打印python日志的两种方法                

# python打印日志

# 1、使用logging
import logging
LOG_FORMAT = "%(asctime)s - %(levelname)s - %(message)s"
logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT)
logging.info("this is a debug message")

# 2、使用loguru
from loguru import logger
logger.debug('this is a debug message')

这是结果 

 

你可能感兴趣的:(python)