fix:debug容错,避免阻塞

This commit is contained in:
lvxiaojiao 2024-08-13 16:31:12 +08:00
parent b123d458bc
commit aafbc5aa31

View File

@ -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);