Showing
2 changed files
with
4 additions
and
11 deletions
| @@ -237,9 +237,10 @@ class ReportAgent: | @@ -237,9 +237,10 @@ class ReportAgent: | ||
| 237 | # 确保日志目录存在 | 237 | # 确保日志目录存在 |
| 238 | log_dir = os.path.dirname(self.config.LOG_FILE) | 238 | log_dir = os.path.dirname(self.config.LOG_FILE) |
| 239 | os.makedirs(log_dir, exist_ok=True) | 239 | os.makedirs(log_dir, exist_ok=True) |
| 240 | - | 240 | + |
| 241 | # 创建专用的logger,避免与其他模块冲突 | 241 | # 创建专用的logger,避免与其他模块冲突 |
| 242 | - logger.add(self.config.LOG_FILE, level="INFO") | 242 | + # 修改日志级别为DEBUG,确保DEBUG、INFO、WARNING、ERROR级别的日志都能被记录 |
| 243 | + logger.add(self.config.LOG_FILE, level="DEBUG") | ||
| 243 | 244 | ||
| 244 | def _initialize_file_baseline(self): | 245 | def _initialize_file_baseline(self): |
| 245 | """ | 246 | """ |
| @@ -4,17 +4,15 @@ LaTeX 数学公式转 SVG 渲染器 | @@ -4,17 +4,15 @@ LaTeX 数学公式转 SVG 渲染器 | ||
| 4 | """ | 4 | """ |
| 5 | 5 | ||
| 6 | import io | 6 | import io |
| 7 | -import logging | ||
| 8 | from typing import Optional | 7 | from typing import Optional |
| 9 | import matplotlib | 8 | import matplotlib |
| 10 | import matplotlib.pyplot as plt | 9 | import matplotlib.pyplot as plt |
| 11 | from matplotlib import mathtext | 10 | from matplotlib import mathtext |
| 11 | +from loguru import logger | ||
| 12 | 12 | ||
| 13 | # 使用非交互式后端 | 13 | # 使用非交互式后端 |
| 14 | matplotlib.use('Agg') | 14 | matplotlib.use('Agg') |
| 15 | 15 | ||
| 16 | -logger = logging.getLogger(__name__) | ||
| 17 | - | ||
| 18 | 16 | ||
| 19 | class MathToSVG: | 17 | class MathToSVG: |
| 20 | """将 LaTeX 数学公式转换为 SVG 的转换器""" | 18 | """将 LaTeX 数学公式转换为 SVG 的转换器""" |
| @@ -185,12 +183,6 @@ if __name__ == "__main__": | @@ -185,12 +183,6 @@ if __name__ == "__main__": | ||
| 185 | # 测试代码 | 183 | # 测试代码 |
| 186 | import sys | 184 | import sys |
| 187 | 185 | ||
| 188 | - # 配置日志 | ||
| 189 | - logging.basicConfig( | ||
| 190 | - level=logging.INFO, | ||
| 191 | - format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' | ||
| 192 | - ) | ||
| 193 | - | ||
| 194 | # 测试公式 | 186 | # 测试公式 |
| 195 | test_formulas = [ | 187 | test_formulas = [ |
| 196 | r"E = mc^2", | 188 | r"E = mc^2", |
-
Please register or login to post a comment