Python 日志文件处理

今天想把 Python 项目中的日志 保存到文件中. 找到了方法.非常简单

https://www.cnblogs.com/nancyzhu/p/8551506.html

1. 

    logging.basicConfig(level=logging.ERROR,  # 控制台打印的日志级别
                        filename='./fund.log',
                        filemode='a',  ##模式,有w和a,w就是写模式,每次都会重新写日志,覆盖之前的日志
                        # a是追加模式,默认如果不写的话,就是追加模式
                        format=
                        '%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s'
                        # 日志格式
                        )

原文地址:https://www.cnblogs.com/chaoren399/p/11194043.html