From aafbc5aa318a23ad74117ee1f3db9dc3a931b2da Mon Sep 17 00:00:00 2001 From: lvxiaojiao Date: Tue, 13 Aug 2024 16:31:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:debug=E5=AE=B9=E9=94=99=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E9=98=BB=E5=A1=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-core/src/utils/debug.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/amis-core/src/utils/debug.tsx b/packages/amis-core/src/utils/debug.tsx index 8f4a23371..edbba4b87 100644 --- a/packages/amis-core/src/utils/debug.tsx +++ b/packages/amis-core/src/utils/debug.tsx @@ -474,11 +474,18 @@ export function debug(cat: Category, msg: string, ext?: object) { console.debug(ext); console.groupEnd(); + let extStr = ''; + try { + extStr = JSON.stringify(ext); + } catch (e) { + console.error(e); + } + const log = { cat, level: 'debug', msg: msg, - ext: JSON.stringify(ext) + ext: extStr }; store.logs.push(log); } @@ -492,11 +499,19 @@ export function warning(cat: Category, msg: string, ext?: object) { if (!isEnabled) { return; } + + let extStr = ''; + try { + extStr = JSON.stringify(ext); + } catch (e) { + console.error(e); + } + const log = { cat, level: 'warn', msg: msg, - ext: JSON.stringify(ext) + ext: extStr }; console.groupCollapsed('amis debug', msg);