diff --git a/src/pages/api/widgets/resources.js b/src/pages/api/widgets/resources.js index 92495d933..66449bff0 100644 --- a/src/pages/api/widgets/resources.js +++ b/src/pages/api/widgets/resources.js @@ -1,5 +1,9 @@ import { existsSync } from "fs"; +import createLogger from "utils/logger"; + +const logger = createLogger("resources"); + const si = require("systeminformation"); export default async function handler(req, res) { @@ -23,26 +27,31 @@ export default async function handler(req, res) { } const fsSize = await si.fsSize(); - + logger.debug("fsSize:", JSON.stringify(fsSize)); return res.status(200).json({ drive: fsSize.find((fs) => fs.mount === target) ?? fsSize.find((fs) => fs.mount === "/"), }); } if (type === "memory") { + const memory = await si.mem(); + logger.debug("memory:", JSON.stringify(memory)); return res.status(200).json({ - memory: await si.mem(), + memory, }); } if (type === "cputemp") { + const cputemp = await si.cpuTemperature(); + logger.debug("cputemp:", JSON.stringify(cputemp)); return res.status(200).json({ - cputemp: await si.cpuTemperature(), + cputemp, }); } if (type === "uptime") { const timeData = await si.time(); + logger.debug("timeData:", JSON.stringify(timeData)); return res.status(200).json({ uptime: timeData.uptime, });