mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 13:17:24 +01:00
Fix for aftermath of https://github.com/HabitRPG/habitrpg/issues/7546 and https://github.com/HabitRPG/habitrpg/issues/7551
21 lines
481 B
JavaScript
21 lines
481 B
JavaScript
'use strict';
|
|
|
|
const chalk = require('chalk');
|
|
|
|
const logger = {
|
|
info: loggerGenerator('info', 'cyan'),
|
|
success: loggerGenerator('info', 'green'),
|
|
error: loggerGenerator('error', 'red'),
|
|
log: loggerGenerator('log', 'white'),
|
|
warn: loggerGenerator('warn', 'yellow'),
|
|
};
|
|
|
|
function loggerGenerator (type, color) {
|
|
return function () {
|
|
let args = Array.from(arguments).map(arg => chalk[color](arg));
|
|
console[type].apply(null, args);
|
|
}
|
|
}
|
|
|
|
module.exports = logger;
|