Skip to content

Commit

Permalink
fix(dev-infra): remove ANSI escape codes from log file outputs (#38792)
Browse files Browse the repository at this point in the history
Remove the ANSI codes from the log file outputs to make the ng-dev log files
more readable.

PR Close #38792
  • Loading branch information
josephperrott authored and AndrewKushnir committed Sep 15, 2020
1 parent dc4f858 commit ef13d8f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dev-infra/utils/console.ts
Expand Up @@ -196,6 +196,9 @@ export function captureLogOutputForCommand(argv: Arguments) {
/** Path to the log file location. */
const logFilePath = join(getRepoBaseDir(), '.ng-dev.log');

// Strip ANSI escape codes from log outputs.
LOGGED_TEXT = LOGGED_TEXT.replace(/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]/g, '');

writeFileSync(logFilePath, LOGGED_TEXT);

// For failure codes greater than 1, the new logged lines should be written to a specific log
Expand Down

0 comments on commit ef13d8f

Please sign in to comment.