📜  python 日志到文件和控制台 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:33.514000             🧑  作者: Mango

代码示例1
import logging

logging.basicConfig(
    level=logging.INFO,
    format="%(asctime)s [%(levelname)s] %(message)s",
    handlers=[
        logging.FileHandler("debug.log"),
        logging.StreamHandler()
    ]
)