Python使用loguru优雅的打印并存储日志
from loguru import logger
logger.add(
"".join([__file__.split(".")[0], ".txt"]),
level='DEBUG',
format='{time:YYYY-MM-DD HH:mm:ss} {level} {file}[line:{line}] {message}',
rotation="10 MB",
retention='10 days',
encoding="utf-8"
)