Skip to content

Commit

Permalink
Update logger to log all arguments passed (#951)
Browse files Browse the repository at this point in the history
  • Loading branch information
FredKSchott authored Aug 28, 2020
1 parent 843cf9e commit 2905af5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions snowpack/src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {performance} from 'perf_hooks';
import onProcessExit from 'signal-exit';
import stream from 'stream';
import url from 'url';
import util from 'util';
import zlib from 'zlib';
import {
generateEnvModule,
Expand Down Expand Up @@ -215,14 +216,14 @@ export async function command(commandOptions: CommandOptions) {
const messageBus = new EventEmitter();

// note: this would cause an infinite loop if not for the logger.on(…) in `paint.ts`.
console.log = (...args) => {
logger.info(args[0]);
console.log = (...args: [any, ...any[]]) => {
logger.info(util.format(...args));
};
console.warn = (...args) => {
logger.warn(args[0]);
console.warn = (...args: [any, ...any[]]) => {
logger.warn(util.format(...args));
};
console.error = (...args) => {
logger.error(args[0]);
console.error = (...args: [any, ...any[]]) => {
logger.error(util.format(...args));
};

paint(
Expand Down

1 comment on commit 2905af5

@vercel
Copy link

@vercel vercel bot commented on 2905af5 Aug 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.