-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.js
51 lines (41 loc) · 858 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
45
46
47
48
49
50
51
const colors = require('colors');
var verbosityLevel = 0;
function v(string) {
if (verbosityLevel == 1) {
console.log(string.grey)
}
}
function vv(string) {
if (verbosityLevel == 2) {
console.log(string.grey)
}
}
function warn(string) {
if (verbosityLevel != 0)
console.log(string.yellow)
}
function warn(string) {
if (verbosityLevel != 0)
console.log(string.yellow)
}
function log(string) {
console.log(" " + string)
}
function logEntry(entry, result) {
var prettyEntry = "["+entry+"]";
console.log(prettyEntry.green + ": " + result.blue);
}
function _log(string) {
if (verbosityLevel != 0)
process.stdout.write(string)
}
function init(verbosity) {
verbosityLevel = verbosity;
}
exports.init = init;
exports.v = v;
exports.vv = vv;
exports.warn = warn;
exports.log = log;
exports._log = _log;
exports.logEntry = logEntry;