summaryrefslogtreecommitdiff
path: root/js/util.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-08-17 16:34:30 -0400
committerGitHub <noreply@github.com>2018-08-17 16:34:30 -0400
commit17b9c5c39028bce80e21d209c1283f8bac462bd9 (patch)
tree670113732364d1976a4b1b0e86f59512bfd3c551 /js/util.ts
parent4a55724f814a4f71b6275ce0f8a97f4720f39dea (diff)
Command line flag parsing (#524)
In particular this allow -D for logging debug output.
Diffstat (limited to 'js/util.ts')
-rw-r--r--js/util.ts15
1 files changed, 8 insertions, 7 deletions
diff --git a/js/util.ts b/js/util.ts
index c1e84610f..c03e47140 100644
--- a/js/util.ts
+++ b/js/util.ts
@@ -1,16 +1,17 @@
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
+import { TypedArray } from "./types";
-//import { debug } from "./main";
-const debug = false;
+let logDebug = false;
-import { TypedArray } from "./types";
+export function setLogDebug(debug: boolean): void {
+ logDebug = debug;
+}
-// Internal logging for deno. Use the "debug" variable above to control
-// output.
+// Debug logging for deno. Enable with the --DEBUG command line flag.
// tslint:disable-next-line:no-any
export function log(...args: any[]): void {
- if (debug) {
- console.log(...args);
+ if (logDebug) {
+ console.log("DEBUG JS -", ...args);
}
}