文件名称:Python中logging模块的用法实例
文件大小:28KB
文件格式:PDF
更新时间:2024-01-13 17:37:47
gi gin IN
本文实例讲述了logging模块的用法实例,分享给大家供大家参考。具体方法如下: import logging import os log = logging.getLogger() formatter = logging.Formatter('[%(asctime)s] [%(name)s] %(levelname)s: %(message)s') stream_handler = logging.StreamHandler() file_handler = logging.FileHandler(os.path.join("c:\\", "analysis.log")) file_