Skip to content

Commit

Permalink
Add timestamp to debug logging (#994)
Browse files Browse the repository at this point in the history
* add timestamp

* cra

* fix linting

* re-add square brackets
  • Loading branch information
sylc committed Apr 7, 2020
1 parent 3f50313 commit 6e56c87
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.ts
Expand Up @@ -38,7 +38,9 @@ function yn (value: string | undefined) {
* Debugging `ts-node`.
*/
const shouldDebug = yn(process.env.TS_NODE_DEBUG)
const debug = shouldDebug ? console.log.bind(console, 'ts-node') : () => undefined
const debug = shouldDebug ?
(...args: any) => console.log(`[ts-node ${new Date().toISOString()}]`, ...args)
: () => undefined
const debugFn = shouldDebug ?
<T, U> (key: string, fn: (arg: T) => U) => {
let i = 0
Expand Down

0 comments on commit 6e56c87

Please sign in to comment.