ignore: add timer log helper

This commit is contained in:
Dax Raad
2025-06-15 13:33:24 -04:00
parent 230d0a1510
commit 7fbb2ca9a6
3 changed files with 24 additions and 5 deletions

View File

@@ -83,6 +83,23 @@ export namespace Log {
clone() {
return Log.create({ ...tags })
},
time(message: string, extra?: Record<string, any>) {
const now = Date.now()
result.info(message, { status: "started", ...extra })
function stop() {
result.info(message, {
status: "completed",
duration: Date.now() - now,
...extra,
})
}
return {
stop,
[Symbol.dispose]() {
stop()
},
}
},
}
return result