Skip to content

Commit 6e56c87

Browse files
authored
Add timestamp to debug logging (#994)
* add timestamp * cra * fix linting * re-add square brackets
1 parent 3f50313 commit 6e56c87

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ function yn (value: string | undefined) {
3838
* Debugging `ts-node`.
3939
*/
4040
const shouldDebug = yn(process.env.TS_NODE_DEBUG)
41-
const debug = shouldDebug ? console.log.bind(console, 'ts-node') : () => undefined
41+
const debug = shouldDebug ?
42+
(...args: any) => console.log(`[ts-node ${new Date().toISOString()}]`, ...args)
43+
: () => undefined
4244
const debugFn = shouldDebug ?
4345
<T, U> (key: string, fn: (arg: T) => U) => {
4446
let i = 0

0 commit comments

Comments
 (0)