Print task run duration time

This commit is contained in:
SukkaW
2023-09-13 14:07:38 +08:00
parent 09c8b62f6a
commit 9f05105b29
17 changed files with 96 additions and 92 deletions

15
Build/lib/trace-runner.js Normal file
View File

@@ -0,0 +1,15 @@
const path = require('path');
/**
* @param {Function} fn
* @param {string} __filename
*/
module.exports.runner = async (__filename, fn) => {
const runnerName = path.basename(__filename, path.extname(__filename));
const start = Date.now();
const result = await fn();
const end = Date.now();
console.log(`⌛ [${runnerName}]: ${end - start}ms`);
return result;
};