summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2019-09-16 01:04:05 +1000
committerRyan Dahl <ry@tinyclouds.org>2019-09-15 11:04:05 -0400
commit8ab48e7ef7278b6313e0c3fb56e9b3bb2b693c06 (patch)
treee76a598f06ddb6ac04a563527723332820a8d9a0 /js
parentc30decab77c4ebeb34ebd1d73b0f45bb26944c79 (diff)
Fix debug logging in runtime/compiler (#2953)
Diffstat (limited to 'js')
-rw-r--r--js/util.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/js/util.ts b/js/util.ts
index 86a856170..013dc7ee1 100644
--- a/js/util.ts
+++ b/js/util.ts
@@ -1,7 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import { TypedArray } from "./types.ts";
import { window } from "./window.ts";
-const { console } = window;
let logDebug = false;
let logSource = "JS";
@@ -20,7 +19,9 @@ export function setLogDebug(debug: boolean, source?: string): void {
*/
export function log(...args: unknown[]): void {
if (logDebug) {
- console.log(`DEBUG ${logSource} -`, ...args);
+ // if we destructure `console` off `window` too early, we don't bind to
+ // the right console, therefore we don't log anything out.
+ window.console.log(`DEBUG ${logSource} -`, ...args);
}
}