christmas/logger.js

13 lines
398 B
JavaScript
Raw Normal View History

2018-11-20 11:19:58 -08:00
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}`));
};
}
}