日志控制

This commit is contained in:
chen wei bo
2025-09-21 19:49:11 +08:00
parent 1e63fc6ab1
commit b94d9527a2
15 changed files with 157 additions and 142 deletions
+7 -6
View File
@@ -5,6 +5,7 @@ import { CommonConfig } from "../Config/CommonConfig";
import li_EventManager from "./li_EventManager";
import Utils from "./Utils";
import { InnerMsgCode } from "../Config/InnerMsgCode";
import { logger } from "db://assets/Scripts/Main/Common/Logger";
const { ccclass } = _decorator;
@@ -49,7 +50,7 @@ export default class LanguageUtils {
} else {
this.detectSystemLanguage();
}
console.log(
logger.log(
"LanguageUtils initialized with language:",
this.currentLanguage
);
@@ -83,7 +84,7 @@ export default class LanguageUtils {
);
Utils.sendInnerMsg(InnerMsgCode.LanguageChange, language);
console.log("Language changed to:", language);
logger.log("Language changed to:", language);
}
public static getText(key: string, defaultText: string = ""): string {
@@ -100,13 +101,13 @@ export default class LanguageUtils {
}
if (!ConfigManager.tables || !ConfigManager.tables.TbLanguage) {
console.warn("Language table not loaded yet");
logger.warn("Language table not loaded yet");
return defaultText || key;
}
const languageData = ConfigManager.tables.TbLanguage.get(key);
if (!languageData) {
console.warn(`Language key not found: ${key}`);
logger.warn(`Language key not found: ${key}`);
return defaultText || key;
}
@@ -147,13 +148,13 @@ export default class LanguageUtils {
}
if (!ConfigManager.tables || !ConfigManager.tables.TbLanguage) {
console.warn("Language table not loaded yet");
logger.warn("Language table not loaded yet");
return defaultText || key;
}
const languageData = ConfigManager.tables.TbLanguage.get(key);
if (!languageData) {
console.warn(`Language key not found: ${key}`);
logger.warn(`Language key not found: ${key}`);
return defaultText || key;
}