This commit is contained in:
seb
2026-09-20 13:14:55 +02:00
parent dbabce2a2d
commit dff254e923
5 changed files with 203 additions and 7 deletions

View File

@@ -48,12 +48,17 @@ function wrapStoreWithTiming(rawStore) {
api[method] = async (...args) => {
const start = Date.now();
try {
return await fn(...args);
} finally {
const duration = Date.now() - start;
const result = await fn(...args);
console.log(
`${chalk.magenta('libstore')} ${namespace}.${method} ${chalk.gray(`(${duration}ms)`)}`
`${chalk.magenta('libstore')} ${namespace}.${method} ${chalk.gray(`(${Date.now() - start}ms)`)}`
);
return result;
} catch (err) {
console.error(
`${chalk.magenta('libstore')} ${namespace}.${method} ${chalk.red('FAILED')} ` +
`${chalk.gray(`(${Date.now() - start}ms)`)} ${chalk.red(err.message)}`
);
throw err;
}
};
}