Python拾趣014 logging日志模块
python内置的日志模块logging可以完成各种日志任务,方便记录软件运行情况,方便回溯。 import logging import os logging.basicConfig(level=logging.INFO, format='%(asctime)s-%(levelname)s : %(message)s') logger = logging.getLogger(__name__) logger.info("Start print log") logger.debug("Do something") logger.warning("Something maybe fail")
用户评论