-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathloger.js
More file actions
34 lines (27 loc) · 731 Bytes
/
loger.js
File metadata and controls
34 lines (27 loc) · 731 Bytes
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
'use strict';
class Logger {
constructor(logColor = '\x1b[42m', errorColor = '\x1b[41m', cookieColor = '\x1b[45m') {
this.logColor = logColor;
this.errorColor = errorColor;
this.cookieColor = cookieColor;
}
setDefaultColor() {
console.log('\x1b[0m');
}
log(...messages) {
console.log(`${this.logColor}${new Date().toISOString()} : ${messages.join(' ')}`);
this.setDefaultColor();
}
error(...messages) {
console.log(`${this.errorColor}${new Date().toISOString()} : ${messages.join(' ')}`);
this.setDefaultColor();
}
cookie(cookie) {
console.log(`${this.cookieColor}${cookie}`);
this.setDefaultColor();
}
}
const logger = new Logger();
module.exports = {
logger
}