-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.js
28 lines (23 loc) · 981 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
let config = {};
config.verbosity = "high";
const runtimeVerbosity = config.verbosity;
class Logger {
static log(messageVerbosity, message) {
if (!messageVerbosity || !message || !(messageVerbosity !== "High" || messageVerbosity !== "Medium" || messageVerbosity !== "Low")) {
throw new Error("Missing logging arguments!");
return;
}
messageVerbosity = messageVerbosity.toLowerCase();
if (runtimeVerbosity === "high" && (messageVerbosity === "high" || messageVerbosity === "medium" || messageVerbosity === "low")) {
console.log(message);
return;
} else if (runtimeVerbosity === "medium" && (messageVerbosity === "medium" || messageVerbosity === "low")) {
console.log(message);
return;
} else if (runtimeVerbosity === "low" && (messageVerbosity === "low")) {
console.log(message);
return;
}
}
}
export default Logger;