refactor: debugLog for frontend (#5587)

This commit is contained in:
Sline
2025-11-25 10:01:04 +08:00
committed by GitHub
parent 64727ad660
commit caca8b2bc4
24 changed files with 181 additions and 99 deletions
+5 -4
View File
@@ -41,6 +41,7 @@ import {
import { useProxiesData } from "@/hooks/app-data";
import { calcuProxies, updateProxyChainConfigInRuntime } from "@/services/cmds";
import { debugLog } from "@/utils/debug";
interface ProxyChainItem {
id: string;
@@ -319,13 +320,13 @@ export const ProxyChain = ({
try {
// 第一步:保存链式代理配置
const chainProxies = proxyChain.map((node) => node.name);
console.log("Saving chain config:", chainProxies);
debugLog("Saving chain config:", chainProxies);
await updateProxyChainConfigInRuntime(chainProxies);
console.log("Chain configuration saved successfully");
debugLog("Chain configuration saved successfully");
// 第二步:连接到代理链的最后一个节点
const lastNode = proxyChain[proxyChain.length - 1];
console.log(`Connecting to proxy chain, last node: ${lastNode.name}`);
debugLog(`Connecting to proxy chain, last node: ${lastNode.name}`);
// 根据模式确定使用的代理组名称
if (mode !== "global" && !selectedGroup) {
@@ -340,7 +341,7 @@ export const ProxyChain = ({
// 刷新代理信息以更新连接状态
mutateProxies();
console.log("Successfully connected to proxy chain");
debugLog("Successfully connected to proxy chain");
} catch (error) {
console.error("Failed to connect to proxy chain:", error);
alert(t("proxies.page.chain.connectFailed") || "连接链式代理失败");