1 | const chalk = require('chalk')
|
2 | const chalkLog = function(type, text, isExit) {
|
3 | console.log(chalk[type](text))
|
4 | isExit && process.exit()
|
5 | }
|
6 | exports.error = function(t, isExit = true) {
|
7 | chalkLog('red', t, isExit)
|
8 | }
|
9 | exports.success = function(t, isExit) {
|
10 | chalkLog('green', t, isExit)
|
11 | }
|
12 | exports.warning = function(t, isExit) {
|
13 | chalkLog('yellow', t, isExit)
|
14 | }
|
15 | exports.info = function(t, isExit) {
|
16 | chalkLog('gray', t, isExit)
|
17 | }
|