christmas/logger.js
2018-11-20 14:19:58 -05:00

12 lines
398 B
JavaScript

const chalk = require('chalk');
const config = require('./config');
const colors = {log: 'blue', success: 'green', error: 'red', warn: 'yellow'};
// rewrite to use Object.keys()
for (let property in colors) {
if (colors.hasOwnProperty(property)) {
module.exports[property] = (type, msg) => {
console.log(chalk.keyword(colors[property])(`[ ${type.toUpperCase()} ] ${msg}`));
};
}
}