mirror of
https://github.com/denoland/deno.git
synced 2025-08-02 18:12:39 +00:00
Command line flag parsing (#524)
In particular this allow -D for logging debug output.
This commit is contained in:
parent
4a55724f81
commit
17b9c5c390
6 changed files with 250 additions and 102 deletions
17
js/util.ts
17
js/util.ts
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue