gristlabs_grist-core/app/server/lib/reportTimeTaken.ts

12 lines
315 B
TypeScript
Raw Normal View History

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);
}
}