fix logger missing debug level, replace console.error with logger.error

This commit is contained in:
Alex Holliday
2024-11-25 10:06:40 +08:00
parent f90208bc0f
commit 6dab90f518
2 changed files with 10 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ import { useSelector } from "react-redux";
import { networkService } from "../../../main";
import PulseDot from "../../../Components/Animated/PulseDot";
import useUtils from "../../Monitors/utils";
import { logger } from "../../../Utils/Logger";
import { formatDurationRounded, formatDurationSplit } from "../../../Utils/timeUtils";
import {
TzTick,
@@ -197,7 +198,7 @@ const InfrastructureDetails = () => {
});
setMonitor(response.data.data);
} catch (error) {
console.error(error);
logger.error(error);
}
};
fetchData();

View File

@@ -44,6 +44,14 @@ class Logger {
this.log = NO_OP;
return;
}
if (logLevel === "debug") {
this.error = console.error.bind(console);
this.warn = console.warn.bind(console);
this.info = console.info.bind(console);
this.log = console.log.bind(console);
return;
}
}
cleanup() {