mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-30 18:52:12 +08:00
refactor: debugLog for frontend (#5587)
This commit is contained in:
@@ -31,6 +31,7 @@ import { BaseDialog, DialogRef, Switch } from "@/components/base";
|
||||
import { useClash } from "@/hooks/use-clash";
|
||||
import { showNotice } from "@/services/noticeService";
|
||||
import { useThemeMode } from "@/services/states";
|
||||
import { debugLog } from "@/utils/debug";
|
||||
import getSystem from "@/utils/get-system";
|
||||
|
||||
const Item = styled(ListItem)(() => ({
|
||||
@@ -580,7 +581,7 @@ export function DnsViewer({ ref }: { ref?: Ref<DialogRef> }) {
|
||||
}, 300);
|
||||
}
|
||||
} catch (err) {
|
||||
console.log("YAML解析错误,忽略自动更新", err);
|
||||
debugLog("YAML解析错误,忽略自动更新", err);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import {
|
||||
patchVergeConfig,
|
||||
} from "@/services/cmds";
|
||||
import { showNotice } from "@/services/noticeService";
|
||||
import { debugLog } from "@/utils/debug";
|
||||
import getSystem from "@/utils/get-system";
|
||||
|
||||
const sleep = (ms: number) =>
|
||||
@@ -238,7 +239,7 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
|
||||
let hostname = "";
|
||||
try {
|
||||
hostname = await getSystemHostname();
|
||||
console.log("获取到主机名:", hostname);
|
||||
debugLog("获取到主机名:", hostname);
|
||||
} catch (err) {
|
||||
console.error("获取主机名失败:", err);
|
||||
}
|
||||
@@ -252,12 +253,12 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
|
||||
if (hostname !== "localhost" && hostname !== "127.0.0.1") {
|
||||
hostname = hostname + ".local";
|
||||
options.push(hostname);
|
||||
console.log("主机名已添加到选项中:", hostname);
|
||||
debugLog("主机名已添加到选项中:", hostname);
|
||||
} else {
|
||||
console.log("主机名与已有选项重复:", hostname);
|
||||
debugLog("主机名与已有选项重复:", hostname);
|
||||
}
|
||||
} else {
|
||||
console.log("主机名为空");
|
||||
debugLog("主机名为空");
|
||||
}
|
||||
|
||||
// 添加IP地址
|
||||
@@ -265,7 +266,7 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
|
||||
|
||||
// 去重
|
||||
const uniqueOptions = Array.from(new Set(options));
|
||||
console.log("最终选项列表:", uniqueOptions);
|
||||
debugLog("最终选项列表:", uniqueOptions);
|
||||
setHostOptions(uniqueOptions);
|
||||
} catch (error) {
|
||||
console.error("获取网络接口失败:", error);
|
||||
|
||||
@@ -15,6 +15,7 @@ import { portableFlag } from "@/pages/_layout";
|
||||
import { showNotice } from "@/services/noticeService";
|
||||
import { useSetUpdateState, useUpdateState } from "@/services/states";
|
||||
import { checkUpdateSafe as checkUpdate } from "@/services/update";
|
||||
import { debugLog } from "@/utils/debug";
|
||||
|
||||
export function UpdateViewer({ ref }: { ref?: Ref<DialogRef> }) {
|
||||
const { t } = useTranslation();
|
||||
@@ -102,7 +103,7 @@ export function UpdateViewer({ ref }: { ref?: Ref<DialogRef> }) {
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
if (currentProgressListener) {
|
||||
console.log("UpdateViewer unmounting, cleaning up progress listener.");
|
||||
debugLog("UpdateViewer unmounting, cleaning up progress listener.");
|
||||
currentProgressListener();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user