Skip to content

Commit e7ca8bf

Browse files
committed
fix: format crumb data on same line as message
Data was printed on a new line, making log output harder to scan. Now prints on the same line with breakLength: Infinity to prevent node inspect from wrapping.
1 parent 2f2d4af commit e7ca8bf

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

.changeset/single-line-output.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"agentcrumbs": patch
3+
---
4+
5+
Format crumb data on the same line as the message instead of a separate line

packages/agentcrumbs/src/cli/format.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function formatDelta(dt: number): string {
1010

1111
function formatData(data: unknown): string {
1212
if (data === undefined || data === null) return "";
13-
return inspect(data, { colors: true, compact: true, depth: 4, breakLength: 100 });
13+
return inspect(data, { colors: true, compact: true, depth: 4, breakLength: Infinity });
1414
}
1515

1616
export function formatCrumbPretty(crumb: Crumb): string {
@@ -61,7 +61,7 @@ export function formatCrumbPretty(crumb: Crumb): string {
6161

6262
const dataStr = formatData(crumb.data);
6363
if (dataStr) {
64-
line += `\n${" ".repeat(depth)} ${dataStr}`;
64+
line += ` ${dataStr}`;
6565
}
6666

6767
return line;

packages/agentcrumbs/src/sinks/console.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function formatDelta(dt: number): string {
1010

1111
function formatData(data: unknown): string {
1212
if (data === undefined || data === null) return "";
13-
return inspect(data, { colors: true, compact: true, depth: 4, breakLength: 120 });
13+
return inspect(data, { colors: true, compact: true, depth: 4, breakLength: Infinity });
1414
}
1515

1616
function indent(depth: number): string {
@@ -62,7 +62,7 @@ export class ConsoleSink implements Sink {
6262

6363
const dataStr = formatData(crumb.data);
6464
if (dataStr) {
65-
line += `\n${pad} ${dataStr}`;
65+
line += ` ${dataStr}`;
6666
}
6767

6868
process.stderr.write(line + "\n");

0 commit comments

Comments
 (0)