@yeepay/yeepay-cli
Version:
易宝前端脚手架
36 lines (33 loc) • 837 B
JavaScript
import chalk from 'chalk'
const colors = ['red', 'green', 'yellow']
/**
* 输出log封装
* @param {string} msg - 展示信息
* @param {boolean} space - 是否有两个空格
* @returns {any}
*/
class Log {
constructor(msg = "", space = true){
this.msg = msg;
this.space = space
}
static enter(){
console.log();
}
static red(msg = "", space = true) {
space
? console.log(chalk['red'](` ` + msg))
: console.log(chalk['red'](msg));
}
static green(msg = "", space = true){
space
? console.log(chalk['green'](` ` + msg))
: console.log(chalk['green'](msg));
}
static yellow(msg = "", space = true){
space
? console.log(chalk['yellow'](` ` + msg))
: console.log(chalk['yellow'](msg));
}
}
export default Log