Added a logging utility class and supplemented, standardized the logging output for all modules.

This commit is contained in:
戒酒的李白
2025-01-27 18:09:30 +08:00
parent 1288b5f0be
commit c62f2b2a8e
13 changed files with 469 additions and 189 deletions
+1 -11
View File
@@ -2,17 +2,7 @@ import os
import pandas as pd
from sqlalchemy import create_engine
from getpass import getpass
import logging
# 配置日志
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s [%(levelname)s] %(message)s',
handlers=[
logging.FileHandler("save_data.log"),
logging.StreamHandler()
]
)
from utils.logger import spider_logger as logging
# 假设 articleAddr 和 commentsAddr 是绝对路径或相对于脚本的路径
from spiderDataPackage.settings import articleAddr, commentsAddr