Skip to content

Commit

Permalink
Prevent logging from clashing with debug module. (#148)
Browse files Browse the repository at this point in the history
* Prevent logging from clashing with `debug` module.

The current implementation clashes with https://www.npmjs.com/package/debug causing unexpected terminal output when a user may have been specifying a pattern intended for the `debug` module.

`debug` has nearly 75 million download per month, so quite lot of people could hit this.

* Specify DEBUG=json2ts to avoid clashing with debug module

* Revert "Prevent logging from clashing with `debug` module."

This reverts commit 1f00910.

* Revert "Specify DEBUG=json2ts to avoid clashing with debug module"

This reverts commit 5955f14.

* process.env.DEBUG -> process.env.VERBOSE

Changed usage of process.env.DEBUG to instead reference process.env.VERBOSE to avoid clashing with `debug` module.
  • Loading branch information
jrylan authored and bcherny committed Mar 14, 2018
1 parent 97798c8 commit fadb879
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## Tips

- Use `npm run tdd` to compile and re-run tests when a file is modified
- Use `DEBUG=true npm run tdd` to add logging output to the above command
- Use `VERBOSE=true npm run tdd` to add logging output to the above command
- Add `export let only=true` to a test in test/e2e to just run that test
- Add `export let exclude=true` to a test in test/e2e to not run that test
- To debug a test, with breakpoints:
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function error(...messages: any[]) {
}

export function log(...messages: any[]) {
if (process.env.DEBUG) {
if (process.env.VERBOSE) {
console.info(whiteBright.bgCyan('debug'), ...messages)
}
}

0 comments on commit fadb879

Please sign in to comment.