Files
habitica/migrations/utils/logger.js
2019-10-08 16:57:10 +02:00

20 lines
477 B
JavaScript

const chalk = require('chalk');
function loggerGenerator (type, color) {
return function logger () {
const args = Array.from(arguments).map(arg => chalk[color](arg));
console[type].apply(null, args);
};
}
const logger = {
info: loggerGenerator('info', 'cyan'),
success: loggerGenerator('info', 'green'),
error: loggerGenerator('error', 'red'),
log: loggerGenerator('log', 'white'),
warn: loggerGenerator('warn', 'yellow'),
};
module.exports = logger;