christmas/logger.js

10 lines
331 B
JavaScript
Raw Normal View History

2020-11-08 13:54:08 -08:00
const chalk = require('chalk')
const colors = { log: 'blue', success: 'green', error: 'red', warn: 'yellow' }
2018-11-20 11:19:58 -08:00
2020-11-08 13:54:08 -08:00
Object.keys(colors).forEach(
method => // eslint-disable-line no-return-assign
module.exports[method] =
(type, msg) =>
console.log(chalk.keyword(colors[method])(`[ ${type.toUpperCase()} ] ${msg}`))
)