export async function logTime(task: string, f: () => Promise): Promise { const start = new Date() console.log(`${start}: '${task}'`) try { return await f() } finally { const now = new Date() console.log(`${now}: finished '${task}' in ${now.getTime() - start.getTime()}ms`) } }