0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

Fix debug logging in runtime/compiler (#2953)

This commit is contained in:
Kitson Kelly 2019-09-16 01:04:05 +10:00 committed by Ryan Dahl
parent c30decab77
commit 8ab48e7ef7

View file

@ -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);
}
}