1 | var prettyjson = require('prettyjson');
|
2 | var erroroptions = {
|
3 | keysColor: 'red',
|
4 | stringColor: 'white'
|
5 | };
|
6 | var successoptions = {
|
7 | keysColor: 'green',
|
8 | stringColor: 'green'
|
9 | };
|
10 | var infooptions = {
|
11 | keysColor: 'grey',
|
12 | stringColor: 'white'
|
13 | };
|
14 |
|
15 |
|
16 | const util = require('util');
|
17 |
|
18 | const system = require('system-commands')
|
19 |
|
20 |
|
21 | function logError(message) {
|
22 | console.log(prettyjson.render(message, erroroptions));
|
23 | };
|
24 |
|
25 | function logSuccess(message) {
|
26 | console.log(prettyjson.render(message, successoptions));
|
27 | };
|
28 |
|
29 | function logInfo(message) {
|
30 | console.log(prettyjson.render(message, infooptions));
|
31 | };
|
32 |
|
33 | function execWithOutput(p) {
|
34 | system(p).then(output => {
|
35 | logInfo(output);
|
36 | }).catch(error => {
|
37 | console.error({ error: error });
|
38 | })
|
39 | };
|
40 |
|
41 |
|
42 | module.exports.logInfo = logInfo;
|
43 | module.exports.logSuccess = logSuccess;
|
44 | module.exports.logError = logError;
|
45 | module.exports.execWithOutput = execWithOutput;
|
46 |
|
47 |
|
\ | No newline at end of file |