summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorKevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com>2018-09-25 01:27:02 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-09-25 01:27:02 -0400
commitf156a86024fc98e63f42c1c7acccac0af10950ef (patch)
treec024ecd75f5574e412eba937b1a46d8a0232e234 /js
parentad5065e23ec33af1422eeffdbb877ef8fd5f6da4 (diff)
console.warn goes to stderr (#810)
Diffstat (limited to 'js')
-rw-r--r--js/console.ts5
-rw-r--r--js/libdeno.ts2
2 files changed, 3 insertions, 4 deletions
diff --git a/js/console.ts b/js/console.ts
index c4c36e7b2..00a24e83c 100644
--- a/js/console.ts
+++ b/js/console.ts
@@ -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;
diff --git a/js/libdeno.ts b/js/libdeno.ts
index 142d779c2..8445a2d2b 100644
--- a/js/libdeno.ts
+++ b/js/libdeno.ts
@@ -8,7 +8,7 @@ interface Libdeno {
send(msg: ArrayBufferView): null | Uint8Array;
- print(x: string): void;
+ print(x: string, isErr?: boolean): void;
setGlobalErrorHandler: (
handler: (