forked from copy-ninja/SmartThings_MyQ
-
-
Notifications
You must be signed in to change notification settings - Fork 871
Expand file tree
/
Copy pathlogger.js
More file actions
22 lines (19 loc) · 545 Bytes
/
logger.js
File metadata and controls
22 lines (19 loc) · 545 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require('colors');
class Logger {
info(msg) {this.write(msg, "info");}
error(msg) {this.write(msg, "error");}
warn(msg) {this.write(msg, "warn");}
write(message, level) {
switch (level) {
case "info":
console.log(`Info: `.green + message)
break;
case "error":
console.error(`Error: `.red + message);
break;
case "warn":
console.log(`Info: `.yellow + message);
}
}
}
module.exports = Logger;