From 6e56c87744a425ca282e9946f91344e00064a03c Mon Sep 17 00:00:00 2001 From: Sylvain Cau Date: Tue, 7 Apr 2020 10:08:08 +0800 Subject: [PATCH] Add timestamp to debug logging (#994) * add timestamp * cra * fix linting * re-add square brackets --- src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 5e6402e00..e3d293a53 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 ? (key: string, fn: (arg: T) => U) => { let i = 0