Skip to content

Commit

Permalink
fix(cli): print Next.js' stderr to improve debug
Browse files Browse the repository at this point in the history
especially for `log4brains build` (see #26)
  • Loading branch information
thomvaill committed Apr 30, 2021
1 parent 7eb267e commit 8f88863
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/web/src/lib/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ export async function execNext(fn: () => Promise<void>): Promise<void> {
const debug = !!process.env.DEBUG;

const capturer = new ConsoleCapturer();
if (debug) {
capturer.onLog = (method, args) => {
capturer.onLog = (method, args, stream) => {
if (stream === "stderr" || debug) {
capturer.doPrintln(...["[Next] ", ...args].map((a) => chalk.dim(a)));
};
}
}
};

capturer.start();
await fn();
capturer.stop();
Expand Down

0 comments on commit 8f88863

Please sign in to comment.