mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
28 lines
633 B
JavaScript
28 lines
633 B
JavaScript
const chalk = require('chalk');
|
|
|
|
const getTime = function () {
|
|
const now = new Date();
|
|
return now.toLocaleString();
|
|
};
|
|
|
|
const log = function (type, message) {
|
|
// const rn = /\n/.test(message) || /\r/.test(message);
|
|
// if (rn) {
|
|
// console.log(chalk[type](`${getTime()}[fes] `));
|
|
// return console.log(chalk[type](message));
|
|
// }
|
|
return console.log(`${getTime()} [fes] ${chalk[type](message)}`);
|
|
};
|
|
|
|
module.exports = {
|
|
error(msg) {
|
|
return log('red', msg);
|
|
},
|
|
warn(msg) {
|
|
return log('yellow', msg);
|
|
},
|
|
message(msg) {
|
|
return log('cyan', msg);
|
|
}
|
|
};
|