Command line flag parsing (#524)

In particular this allow -D for logging debug output.
This commit is contained in:
Ryan Dahl 2018-08-17 16:34:30 -04:00 committed by GitHub
parent 4a55724f81
commit 17b9c5c390
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 250 additions and 102 deletions

View file

@ -1,16 +1,17 @@
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
//import { debug } from "./main";
const debug = false;
import { TypedArray } from "./types";
// Internal logging for deno. Use the "debug" variable above to control
// output.
let logDebug = false;
export function setLogDebug(debug: boolean): void {
logDebug = debug;
}
// 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);
}
}