From 9b718e4c93921d7f9c8b82c2418f6dc4b9baabe5 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Sun, 6 Oct 2024 22:56:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=94=99=E8=AF=AF=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=97=B6=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/common/logger.ts | 10 ++++++++++ src/data/logger.json | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/core/common/logger.ts b/src/core/common/logger.ts index 433d762..1e4abe9 100644 --- a/src/core/common/logger.ts +++ b/src/core/common/logger.ts @@ -107,6 +107,11 @@ export class Logger { * @param params 参数 */ error(code: number, ...params: string[]) { + const info = logError[code]; + if (!info) { + logger.error(16, 'error', code.toString()); + return; + } const text = this.parseInfo(logError[code], ...params); if (this.catching) { this.catchedInfo.push({ @@ -132,6 +137,11 @@ export class Logger { * @param text 警告信息 */ warn(code: number, ...params: string[]) { + const info = logWarn[code]; + if (!info) { + logger.error(16, 'warn', code.toString()); + return; + } const text = this.parseInfo(logWarn[code], ...params); if (this.catching) { this.catchedInfo.push({ diff --git a/src/data/logger.json b/src/data/logger.json index 5e5b70f..f8b9b91 100644 --- a/src/data/logger.json +++ b/src/data/logger.json @@ -15,11 +15,11 @@ "13": "Cannot compile $1 shader. Error info: $2", "14": "Animate extension needs 'floor-hero' extension as dependency.", "15": "Viewport extension needs 'floor-hero' extension as dependency.", + "16": "Cannot find log message for $1 code $2.", "1101": "Shadow extension needs 'floor-hero' extension as dependency.", "1201": "Floor-damage extension needs 'floor-binder' extension as dependency.", "1301": "Portal extension need 'floor-binder' extension as dependency.", - "1401": "Halo extension needs 'floor-binder' extension as dependency.", - "1501": "Cannot add listener to started chase." + "1401": "Halo extension needs 'floor-binder' extension as dependency." }, "warn": { "1": "Resource with type of 'none' is loaded.",