From 6dab90f5184abfe9839b7d12bfb1cfd42a8051ef Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Mon, 25 Nov 2024 10:06:40 +0800 Subject: [PATCH] fix logger missing debug level, replace console.error with logger.error --- Client/src/Pages/Infrastructure/Details/index.jsx | 3 ++- Client/src/Utils/Logger.js | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Client/src/Pages/Infrastructure/Details/index.jsx b/Client/src/Pages/Infrastructure/Details/index.jsx index d32e94d50..bdb43123c 100644 --- a/Client/src/Pages/Infrastructure/Details/index.jsx +++ b/Client/src/Pages/Infrastructure/Details/index.jsx @@ -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(); diff --git a/Client/src/Utils/Logger.js b/Client/src/Utils/Logger.js index 177391b99..b22cc0a22 100644 --- a/Client/src/Utils/Logger.js +++ b/Client/src/Utils/Logger.js @@ -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() {