refactor: 重命名Logger类并增加错误日志方法
- 将Logger类重命名为mLogger以符合命名规范 - 新增error方法用于统一错误输出 - 在多个组件中替换console.log/warn/error为mLogger的对应方法 - 为多个组件添加debugMode属性以控制模块级日志开关 - 新增HeroMasterComp组件框架
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export class Logger {
|
||||
export class mLogger {
|
||||
/** 总开关:控制所有日志输出 */
|
||||
public static GLOBAL_ENABLED: boolean = true;
|
||||
|
||||
@@ -25,4 +25,16 @@ export class Logger {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user