Skip to content

Commit

Permalink
fix: 修复 debug 日志打印不全的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
2betop committed Nov 29, 2024
1 parent 59de942 commit 7c2ba58
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/amis-core/src/utils/debug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,25 @@ const LogView = observer(({store}: {store: AMISDebugStore}) => {
return (
<>
{logs.map((log, index) => {
let ext =
typeof log.ext === 'string' &&
(log.ext.startsWith('{') || log.ext.startsWith('['))
? parseJson(log.ext)
: typeof log.ext === 'object'
? parseJson(JSON.stringify(log.ext))
: log.ext;

return (
<div className="AMISDebug-logLine" key={`log-${index}`}>
<div className="AMISDebug-logLineMsg">
[{log.cat}] {log.msg}
</div>
{(typeof log.ext === 'string' &&
(log.ext.startsWith('{') || log.ext.startsWith('['))) ||
typeof log.ext === 'object' ? (
{typeof ext === 'object' ? (
<React.Suspense fallback={<div>Loading...</div>}>
<JsonView
name={null}
theme="monokai"
src={
typeof log.ext === 'string' ? parseJson(log.ext) : log.ext
}
src={ext}
collapsed={true}
enableClipboard={false}
displayDataTypes={false}
Expand All @@ -125,7 +129,7 @@ const LogView = observer(({store}: {store: AMISDebugStore}) => {
/>
</React.Suspense>
) : (
<pre className="AMISDebug-value">{JSON.stringify(log.ext)}</pre>
<pre className="AMISDebug-value">{JSON.stringify(ext)}</pre>
)}
</div>
);
Expand Down

0 comments on commit 7c2ba58

Please sign in to comment.