日志控制

This commit is contained in:
chen wei bo
2025-09-21 20:05:39 +08:00
parent b94d9527a2
commit 23c038fd14
10 changed files with 343 additions and 332 deletions
+7 -6
View File
@@ -13,6 +13,7 @@ import {
} from "cc";
import li_EventManager from "./li_EventManager";
import LanguageUtils from "./LanguageUtils";
import { logger } from "db://assets/Scripts/Main/Common/Logger";
const { ccclass, property } = _decorator;
@@ -22,21 +23,21 @@ export default class Utils {
public static Log(msg: string | any, ...subst: any[]) {
let IsLocalCSChanel = true;
if (IsLocalCSChanel) {
console.log(msg, subst);
logger.log(msg, subst);
}
}
//警告日志
public static Warning(msg: string | any, ...subst: any[]) {
let IsLocalCSChanel = true;
if (IsLocalCSChanel) {
console.warn(msg, subst);
logger.warn(msg, subst);
}
}
//错误日志
public static Error(msg: string | any, ...subst: any[]) {
let IsLocalCSChanel = true;
if (IsLocalCSChanel) {
console.error(msg, subst);
logger.error(msg, subst);
}
}
@@ -258,7 +259,7 @@ export default class Utils {
public static getScaleRatio(mod: number = 1) {
let windowSize = view.getVisibleSize();
let designSize = view.getDesignResolutionSize();
// console.log("游戏分辨率:", windowSize, designSize);
// logger.log("游戏分辨率:", windowSize, designSize);
if (mod == 1) {
return windowSize.height / designSize.height;
} else {
@@ -367,7 +368,7 @@ export default class Utils {
public static ProfilerTimePrint(key: string = "") {
let time = new Date().getTime();
let timecha = time - Utils._eplTime;
console.log(`${key}消耗时间:${timecha}毫秒`);
logger.log(`${key}消耗时间:${timecha}毫秒`);
Utils._eplTime = time;
}
@@ -381,7 +382,7 @@ export default class Utils {
const days = Math.floor(diffSeconds / (60 * 60 * 24));
const hours = Math.floor((diffSeconds % (60 * 60 * 24)) / 3600);
const minutes = Math.floor((diffSeconds % 3600) / 60);
console.log(
logger.log(
"vip失效剩余时间差(秒):",
diffSeconds,
"天:",