mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
12 lines
315 B
TypeScript
12 lines
315 B
TypeScript
|
import * as log from 'app/server/lib/log';
|
||
|
|
||
|
export function reportTimeTaken<T>(locationLabel: string, callback: () => T): T {
|
||
|
const start = Date.now();
|
||
|
try {
|
||
|
return callback();
|
||
|
} finally {
|
||
|
const timeTaken = Date.now() - start;
|
||
|
log.debug("Time taken in %s: %s ms", locationLabel, timeTaken);
|
||
|
}
|
||
|
}
|