-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
48 lines (42 loc) · 681 Bytes
/
Copy pathindex.js
File metadata and controls
48 lines (42 loc) · 681 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* eslint no-console:0 */
/**
* @module Logger
*/
/**
* The Logger class
* @class
*/
class Logger {
/**
* Create an instance of Logger class
* @param {loglevel} loglevel - the log level (prod: 0, stage: 1, dev: 2 )
*/
constructor(loglevel) {
this.loglevel = loglevel;
}
/**
* log the errors
*/
error(...args) {
if (this.loglevel >= 0) {
console.error(...args);
}
}
/**
* log the warning
*/
warn(...args) {
if (this.loglevel > 0) {
console.warn(...args);
}
}
/**
* debugging logs
*/
log(...args) {
if (this.loglevel > 1) {
console.log(...args);
}
}
}
export default Logger;