Skip to content

Commit 945956a

Browse files
committed
fix: apply filterFields per-element in formatTraceLogs
filterFields expects a single object, not an array. Map over each log entry individually to apply field filtering correctly.
1 parent 3c07efc commit 945956a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lib/formatters/log.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,10 @@ export function formatTraceLogs(options: FormatTraceLogsOptions): string {
349349

350350
if (asJson) {
351351
const reversed = [...logs].reverse();
352-
return `${formatJson(fields ? filterFields(reversed, fields) : reversed)}\n`;
352+
const data = fields
353+
? reversed.map((entry) => filterFields(entry, fields))
354+
: reversed;
355+
return `${formatJson(data)}\n`;
353356
}
354357

355358
if (logs.length === 0) {

0 commit comments

Comments
 (0)