Skip to content

Commit faa7807

Browse files
committed
2 parents 555b333 + 719f5ea commit faa7807

File tree

6 files changed

+11
-16
lines changed

6 files changed

+11
-16
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.10.5-63b9e00
1+
v1.10.5-f5e974b

core/cluster.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,10 @@ async def error(*responses: aiohttp.ClientResponse):
221221
history = list((ResponseRedirects(resp.status, str(resp.real_url)) for resp in responses))
222222
source = "主控" if len(history) == 1 else "节点"
223223
for history in history:
224-
msg.append(f" > {history.status} | {history.url}")
224+
msg.append(f"> {history.status} | {history.url}")
225225
history = '\n'.join(msg)
226-
logger.error(f"下载错误 {file.hash}({unit.format_bytes(file.size)}) 来自{source}地址 [{responses[-1].host}] 响应 [{responses[-1].status}] 历史地址:\n{history}")
226+
logger.terror("cluster.error.download.failed", hash=file.hash, size=unit.format_bytes(file.size),
227+
source=source, host=responses[-1].host, status=responses[-1].status, history=history)
227228
while not self.queues.empty() and storages.available:
228229
async with aiohttp.ClientSession(
229230
BASE_URL,
@@ -269,7 +270,7 @@ async def error(*responses: aiohttp.ClientResponse):
269270
continue
270271
r = await self._mount_file(file, content)
271272
if r[0] == -1:
272-
logger.error("放入存储时候错误")
273+
logger.terror("cluster.error.download.failed_to_upload")
273274
await put(size, file)
274275
continue
275276

core/logger.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ def debug(self, *args, **kwargs):
5757
def warn(self, *args, **kwargs):
5858
self._log_with_args("WARNING", *args, **kwargs)
5959

60-
def exception(self, *args, **kwargs):
61-
self._log_with_args("EXCEPTION", *args, **kwargs)
62-
6360
def success(self, *args, **kwargs):
6461
self._log_with_args("SUCCESS", *args, **kwargs)
6562

@@ -83,11 +80,6 @@ def twarn(self, key: str, failed_prompt=True, *args, **kwargs):
8380
"WARNING", locale.t(key=key, failed_prompt=failed_prompt, *args, **kwargs)
8481
)
8582

86-
def texception(self, key: str, failed_prompt=True, *args, **kwargs):
87-
self._log_with_args(
88-
"EXCEPTION", locale.t(key=key, failed_prompt=failed_prompt, *args, **kwargs)
89-
)
90-
9183
def tsuccess(self, key: str, failed_prompt=True, *args, **kwargs):
9284
self._log_with_args(
9385
"SUCCESS", locale.t(key=key, failed_prompt=failed_prompt, *args, **kwargs)

core/network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ async def start():
229229
"core.info.listening_ssl",
230230
port=ssl_server.sockets[0].getsockname()[1],
231231
)
232-
logger.info(locale.t("core.info.listening", port=PORT))
232+
logger.tinfo("core.info.listening", port=PORT)
233233
if cert:
234234
async with server, ssl_server:
235235
await asyncio.gather(server.serve_forever(), ssl_server.serve_forever())

i18n/zh_cn.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
"cluster.tqdm.desc.download": "下载文件中",
2323
"cluster.debug.download_temp.downloading": "正在下载文件:$hash。",
2424
"cluster.debug.download_temp.downloaded": "成功下载文件:$hash。",
25+
"cluster.error.download.failed": "无法下载文件 $hash($size)($source $host $status),历史地址:\n$history",
26+
"cluster.error.download.failed_to_upload": "在尝试上传文件时发生错误。",
2527
"cluster.info.download.finished": "成功下载所有文件。",
2628
"cluster.info.check_files.check_type": "当前文件检查模式:$type。",
2729
"cluster.warn.check_files.skipped": "当前并无可用文件,已跳过文件检查。",
@@ -80,5 +82,5 @@
8082
"stats.error.broken_stats": "统计信息已损坏……",
8183
"system.info.loading": "正在初始化系统信息统计……",
8284
"timings.info.finished": "任务已完成,耗时:$time。",
83-
"cluster.info.download.configuration": "下载配置策略:$type 下载源:$source 下载并发:$concurrency"
85+
"cluster.info.download.configuration": "下载配置策略:$type下载源:$source下载并发:$concurrency"
8486
}

plugins/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def get_name(self):
5555

5656

5757
def load_plugins():
58-
logger.info(locale.t("plugins.info.attempt_loading"))
58+
logger.tinfo("plugins.info.attempt_loading")
5959
dirlist = os.listdir("./plugins")
6060
for file in dirlist:
6161
load = None
@@ -67,7 +67,7 @@ def load_plugins():
6767
if file[0] != "_" and file.endswith(".py"):
6868
load = file[:-3]
6969
if load:
70-
logger.debug(locale.t("plugins.debug.loading", name=load))
70+
logger.debug("plugins.debug.loading", name=load)
7171
try:
7272
plugin = Plugin(importlib.import_module("plugins." + load))
7373
logger.info(

0 commit comments

Comments
 (0)