Add none logging level, update readme
This commit is contained in:
1 parent
5c561d87ce
commit
5eb022a3c2
2 files changed
+15
-6
No files matched your search
@@ -3,6 +3,13 @@ class Logger {
|
||||
constructor(logLevel) {
|
||||
const NO_OP = () => {};
|
||||
|
||||
if (logLevel === "none") {
|
||||
this.error = NO_OP;
|
||||
this.warn = NO_OP;
|
||||
this.log = NO_OP;
|
||||
return;
|
||||
}
|
||||
|
||||
this.error = console.error.bind(console);
|
||||
|
||||
if (logLevel === "error") {
|
||||
@@ -14,6 +21,7 @@ class Logger {
|
||||
|
||||
if (logLevel === "warn") {
|
||||
this.log = NO_OP;
|
||||
return;
|
||||
}
|
||||
this.log = console.log.bind(console);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user