console.warn goes to stderr (#810)

This commit is contained in:
Kevin (Kun) "Kassimo" Qian 2018-09-25 01:27:02 -04:00 committed by Ryan Dahl
parent ad5065e23e
commit f156a86024
4 changed files with 13 additions and 8 deletions

View file

@ -110,7 +110,7 @@ export function stringifyArgs(args: any[]): string {
return out.join(" ");
}
type PrintFunc = (x: string) => void;
type PrintFunc = (x: string, isErr?: boolean) => void;
export class Console {
constructor(private printFunc: PrintFunc) {}
@ -125,8 +125,7 @@ export class Console {
// tslint:disable-next-line:no-any
warn(...args: any[]): void {
// TODO Log to stderr.
this.printFunc(stringifyArgs(args));
this.printFunc(stringifyArgs(args), true);
}
error = this.warn;