Files
panw 63dd22fb88 refactor: 重命名Logger类并增加错误日志方法
- 将Logger类重命名为mLogger以符合命名规范
- 新增error方法用于统一错误输出
- 在多个组件中替换console.log/warn/error为mLogger的对应方法
- 为多个组件添加debugMode属性以控制模块级日志开关
- 新增HeroMasterComp组件框架
2026-02-03 14:40:02 +08:00

41 lines
1.2 KiB
TypeScript

export class mLogger {
/** 总开关:控制所有日志输出 */
public static GLOBAL_ENABLED: boolean = true;
/**
* 统一日志输出
* @param enable 单独开关(模块级开关)
* @param tag 标签(通常是类名或模块名)
* @param args 日志内容
*/
public static log(enable: boolean, tag: string, ...args: any[]) {
if (this.GLOBAL_ENABLED && enable) {
console.log(`[${tag}]`, ...args);
}
}
/**
* 统一警告输出
* @param enable 单独开关(模块级开关)
* @param tag 标签(通常是类名或模块名)
* @param args 警告内容
*/
public static warn(enable: boolean, tag: string, ...args: any[]) {
if (this.GLOBAL_ENABLED && enable) {
console.warn(`[${tag}]`, ...args);
}
}
/**
* 统一错误输出
* @param enable 单独开关(模块级开关)
* @param tag 标签(通常是类名或模块名)
* @param args 错误内容
*/
public static error(enable: boolean, tag: string, ...args: any[]) {
if (this.GLOBAL_ENABLED && enable) {
console.error(`[${tag}]`, ...args);
}
}
}