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

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

No files matched your search

@@ -9,6 +9,7 @@ import { useSelector } from "react-redux";
import { networkService } from "../../../main"; import { networkService } from "../../../main";
import PulseDot from "../../../Components/Animated/PulseDot"; import PulseDot from "../../../Components/Animated/PulseDot";
import useUtils from "../../Monitors/utils"; import useUtils from "../../Monitors/utils";
import { logger } from "../../../Utils/Logger";
import { formatDurationRounded, formatDurationSplit } from "../../../Utils/timeUtils"; import { formatDurationRounded, formatDurationSplit } from "../../../Utils/timeUtils";
import { import {
TzTick, TzTick,
@@ -197,7 +198,7 @@ const InfrastructureDetails = () => {
}); });
setMonitor(response.data.data); setMonitor(response.data.data);
} catch (error) { } catch (error) {
console.error(error); logger.error(error);
} }
}; };
fetchData(); fetchData();
+8
View File
@@ -44,6 +44,14 @@ class Logger {
this.log = NO_OP; this.log = NO_OP;
return; 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() { cleanup() {