From afaa7bb2f0bc955816e99bfcafd3e1699793d607 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Fri, 24 Nov 2023 16:03:35 +0800 Subject: [PATCH] Do not process debug log for production --- src/util.js | 3 +++ src/util.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/util.js b/src/util.js index 6b8f8f37..8936ffbf 100644 --- a/src/util.js +++ b/src/util.js @@ -101,6 +101,9 @@ class Logger { * @param level Log level. One of INFO, WARN, ERROR, DEBUG or can be customized. */ log(module, msg, level) { + if (level === "DEBUG" && !exports.isDev) { + return; + } if (this.hideLog[level] && this.hideLog[level].includes(module.toLowerCase())) { return; } diff --git a/src/util.ts b/src/util.ts index e8a2706e..4f62fe76 100644 --- a/src/util.ts +++ b/src/util.ts @@ -115,6 +115,10 @@ class Logger { * @param level Log level. One of INFO, WARN, ERROR, DEBUG or can be customized. */ log(module: string, msg: any, level: string) { + if (level === "DEBUG" && !isDev) { + return; + } + if (this.hideLog[level] && this.hideLog[level].includes(module.toLowerCase())) { return; }