fix: 修整所有日志与报错为中文

This commit is contained in:
DLmaster361
2025-08-30 20:30:43 +08:00
parent 389e06cf9e
commit f62740f20b
20 changed files with 363 additions and 422 deletions

View File

@@ -48,7 +48,7 @@ class ImageUtils:
@staticmethod
def compress_image_if_needed(image_path: Path, max_size_mb=2) -> Path:
"""
如果图片大于max_size_mb则压缩并覆盖原文件返回原始路径Path对象
如果图片大于max_size_mb, 则压缩并覆盖原文件, 返回原始路径Path对象
"""
RESAMPLE = Image.Resampling.LANCZOS # Pillow 9.1.0及以后
@@ -82,6 +82,6 @@ class ImageUtils:
height = int(height * 0.95)
img = img.resize((width, height), RESAMPLE)
else:
raise ValueError("仅支持JPG/JPEG和PNG格式图片的压缩")
raise ValueError("仅支持JPG/JPEG和PNG格式图片的压缩")
return image_path

View File

@@ -59,7 +59,7 @@ class LogMonitor:
async def monitor_log(self):
"""监控日志文件的主循环"""
if self.log_file_path is None or not self.log_file_path.exists():
raise ValueError("Log file path is not set or does not exist.")
raise ValueError("日志文件路径未设置或文件不存在")
logger.info(f"开始监控日志文件: {self.log_file_path}")
@@ -127,7 +127,7 @@ class LogMonitor:
"""启动监控"""
if log_file_path.is_dir():
raise ValueError(f"Log file cannot be a directory: {log_file_path}")
raise ValueError(f"日志文件不能是目录: {log_file_path}")
if self.task is not None and not self.task.done():
await self.stop()

View File

@@ -27,7 +27,7 @@ from pathlib import Path
class ProcessManager:
"""进程监视器类用于跟踪主进程及其所有子进程的状态"""
"""进程监视器类, 用于跟踪主进程及其所有子进程的状态"""
def __init__(self):
super().__init__()
@@ -41,7 +41,7 @@ class ProcessManager:
self, path: Path, args: list = [], tracking_time: int = 60
) -> None:
"""
启动一个新进程并返回其pid并开始监视该进程
启动一个新进程并返回其pid, 并开始监视该进程
Parameters
----------
@@ -63,7 +63,7 @@ class ProcessManager:
async def start_monitoring(self, pid: int, tracking_time: int = 60) -> None:
"""
启动进程监视器跟踪指定的主进程及其子进程
启动进程监视器, 跟踪指定的主进程及其子进程
:param pid: 被监视进程的PID
:param tracking_time: 子进程追踪持续时间(秒)

View File

@@ -456,7 +456,7 @@ MATERIALS_MAP = {
"3261": "医疗芯片",
"3271": "辅助芯片",
"3281": "特种芯片",
"emoticon_originium_slug": "表情套组虫动",
"emoticon_originium_slug": "表情套组: 虫动",
"act29side_frag_1": "乐之节符",
"act29side_frag_2": "怒之节符",
"act29side_frag_3": "哀之节符",

View File

@@ -60,7 +60,7 @@ def get_logger(module_name: str):
"""
获取一个绑定 module 名的日志器
:param module_name: 模块名称"用户管理"
:param module_name: 模块名称, "用户管理"
:return: 绑定后的 logger
"""
return _logger.bind(module=module_name)