21 lines
464 B
JavaScript
21 lines
464 B
JavaScript
import chalk from 'chalk';
|
|
|
|
function timestamp() {
|
|
return chalk.gray(new Date().toISOString());
|
|
}
|
|
|
|
export const logger = {
|
|
info(...args) {
|
|
console.log(timestamp(), chalk.cyan('INFO'), ...args);
|
|
},
|
|
success(...args) {
|
|
console.log(timestamp(), chalk.green('OK'), ...args);
|
|
},
|
|
warn(...args) {
|
|
console.warn(timestamp(), chalk.yellow('WARN'), ...args);
|
|
},
|
|
error(...args) {
|
|
console.error(timestamp(), chalk.red('ERROR'), ...args);
|
|
},
|
|
};
|