Genesis
This commit is contained in:
20
src/logger.js
Normal file
20
src/logger.js
Normal file
@@ -0,0 +1,20 @@
|
||||
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);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user