Skip to content

Commit e2ff23c

Browse files
danymarquesDany Marques (u118970)
authored andcommitted
refactor: enhance debug logging with chalk for better readability
1 parent 05a6c85 commit e2ff23c

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

runner/codegen/base-cli-agent-runner.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {ChildProcess, spawn} from 'child_process';
22
import {join, relative} from 'path';
33
import {existsSync} from 'fs';
44
import assert from 'assert';
5+
import chalk from 'chalk';
56
import {
67
LocalLlmConstrainedOutputGenerateResponse,
78
LocalLlmGenerateFilesRequestOptions,
@@ -23,15 +24,10 @@ function debugLog(category: string, message: string, data?: unknown): void {
2324
return;
2425
}
2526
const timestamp = new Date().toISOString();
26-
const cyan = '\x1b[36m';
27-
const dim = '\x1b[2m';
28-
const reset = '\x1b[0m';
29-
console.error(
30-
`${cyan}[DEBUG ${dim}${timestamp}${reset}${cyan}] [${category}] ${message}${reset}`,
31-
);
27+
console.error(chalk.cyan(`[DEBUG ${chalk.dim(timestamp)}] [${category}] ${message}`));
3228
if (data !== undefined) {
3329
console.error(
34-
`${cyan}[DEBUG ${dim}${timestamp}${reset}${cyan}] [${category}] Data:${reset}`,
30+
chalk.cyan(`[DEBUG ${chalk.dim(timestamp)}] [${category}] Data:`),
3531
JSON.stringify(data, null, 2),
3632
);
3733
}

0 commit comments

Comments
 (0)