forked from vuejs/vue-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.js
44 lines (36 loc) · 850 Bytes
/
logger.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var chalk = require('chalk')
var format = require('util').format
/**
* Prefix.
*/
var prefix = ' vue-cli'
var sep = chalk.gray('·')
/**
* Log a `message` to the console.
*
* @param {String} message
*/
exports.log = function () {
var msg = format.apply(format, arguments)
console.log(chalk.white(prefix), sep, msg)
}
/**
* Log an error `message` to the console and exit.
*
* @param {String} message
*/
exports.fatal = function (message) {
if (message instanceof Error) message = message.message.trim()
var msg = format.apply(format, arguments)
console.error(chalk.red(prefix), sep, msg)
process.exit(1)
}
/**
* Log a success `message` to the console and exit.
*
* @param {String} message
*/
exports.success = function () {
var msg = format.apply(format, arguments)
console.log(chalk.white(prefix), sep, msg)
}