1 |
|
2 |
|
3 | const chalk = require('chalk')
|
4 | const format = require('util').format
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | const prefix = ' Quasar CLI'
|
11 | const sep = chalk.gray('·')
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | exports.log = function (...args) {
|
20 | const msg = format.apply(format, args)
|
21 | console.log(chalk.white(prefix), sep, msg)
|
22 | }
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | module.exports.fatal = function (...args) {
|
31 | if (args[0] instanceof Error) args[0] = args[0].message.trim()
|
32 | const msg = format.apply(format, args)
|
33 | console.error(chalk.red(prefix), sep, msg)
|
34 | process.exit(1)
|
35 | }
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | module.exports.success = function (...args) {
|
44 | const msg = format.apply(format, args)
|
45 | console.log(chalk.white(prefix), sep, msg)
|
46 | }
|