-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.js
61 lines (48 loc) · 1.08 KB
/
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
52
53
54
55
56
57
58
59
60
61
/**
* This class acts as a logger. Used to log commands in the console
*/
class Logger
{
// Constructor
constructor()
{
}
//--------------------------------------------------------------
/**
* Information message
* @param string msg
*/
inform(msg) {
this.cprint('INFO: ' + msg);
}
//--------------------------------------------------------------
/**
* Warning message
*/
warn(msg) {
this.cprint('WARN: ' + msg, '#f43e6d');
}
//--------------------------------------------------------------
/**
* Alert message
*/
alert(msg) {
this.cprint('ALERT: ' + msg, '#00ff07');
}
//--------------------------------------------------------------
/**
* Error message
*/
error(msg) {
this.cprint('ERROR: ' + msg, '#e59821');
}
//--------------------------------------------------------------
/**
* This is the function that actually prints the message
*/
cprint(msg, color = '#ffffff') {
console.log('<span style="color: ' + color + '">' + msg + '</span>');
}
}
// Export
module.exports = Logger;