You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shop-admin/src/utils/debug.js

18 lines
348 B

const during = (func, name = 'func') => {
let time = Date.now(),
error = null;
try {
func();
} catch (e) {
error = e;
}
const msg = `[debug] exec ${name} during ${Date.now() - time}ms`;
if (error) {
msg += ' with error';
}
console.info(msg, error);
};
export default {
during,
};