MCPcopy Index your code
hub / github.com/node-js-libs/node.io / status

Function status

lib/node.io/utils.js:18–52  ·  view source on GitHub ↗
(msg, type)

Source from the content-addressed store, hash-verified

16 * @api public
17 */
18var status = function (msg, type) {
19 var cmd = type;
20
21 switch (type) {
22 case 'info':
23 msg = '\x1B[33mINFO\x1B[0m: ' + msg;
24 break;
25
26 case 'debug':
27 cmd = 'info';
28 msg = '\x1B[36mDEBUG\x1B[0m: ' + msg;
29 break;
30
31 case 'error':
32 case 'fatal':
33 cmd = 'error';
34 msg = '\x1B[31mERROR\x1B[0m: ' + msg;
35 break;
36
37 case 'ok':
38 cmd = 'info';
39 msg = '\x1B[32mOK\x1B[0m: ' + msg;
40 break;
41
42 case 'bold':
43 cmd = 'info';
44 msg = '\x1B[33mINFO\x1B[0m: \x1B[1m' + msg + '\x1B[0m';
45 break;
46 }
47
48 console[cmd](msg); //Write output according to status severity
49 if (type === 'fatal') {
50 process.exit(1);
51 }
52};
53exports.status = {};
54['info', 'error', 'fatal', 'ok', 'debug', 'bold'].forEach(function (type) {
55 exports.status[type] = function (msg) {

Callers 3

utils.jsFile · 0.85
startFunction · 0.85
stopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected