Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/amis-core/src/utils/debug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,14 @@ function normalizeDataForLog(data: any) {
}
}

export function safeStringify(data: any) {
try {
return JSON.stringify(data);
} catch {
return data;
}
}

/**
* 一般调试日志
* @param msg 简单消息
Expand All @@ -619,7 +627,7 @@ export function debug(cat: Category, msg: string, ext?: any) {
cat,
level: 'debug',
msg: msg,
ext: ext
ext: safeStringify(ext) // 因为 mobx 会加工,导致性能问题,所以转成字符串最简单
};
store.logs.push(log);
// 不要超过 200 条,担心性能问题
Expand Down
Loading