Logging Update

- Changed to uniform logging with the 'debug' module
- Updated all apps
This commit is contained in:
Logan Cusano
2022-12-11 21:11:29 -05:00
parent e403560165
commit e5d885cc3e
21 changed files with 105 additions and 53 deletions

View File

@@ -1,5 +1,9 @@
const mysqlHander = require("../mysqlHandler");
const utils = require("../utils");
// Debug
const { DebugBuilder } = require("../utilities/debugBuilder.js");
const log = new DebugBuilder("server", "nodesController");
// Utilities
const mysqlHander = require("../utilities/mysqlHandler");
const utils = require("../utilities/utils");
exports.listAllNodes = async (req, res) => {
mysqlHander.getAllNodes((allNodes) => {
@@ -32,7 +36,7 @@ exports.newNode = async (req, res) => {
if (err === "No name provided") {
return res.sendStatus(400);
}
else console.log(err)
else log.ERROR(err)
return res.sendStatus(500);
}
}
@@ -65,7 +69,7 @@ exports.nodeCheckIn = async (req, res) => {
// If no changes are made tell the client
if (Object.keys(nodeObject).length === 0) return res.status(200).json("No keys updated");
console.log("Updating the following keys for ID:", req.body.id, nodeObject);
log.INFO("Updating the following keys for ID: ", req.body.id, nodeObject);
// Adding the ID key to the body so that the client can double-check their ID
nodeObject.id = req.body.id;
mysqlHander.updateNodeInfo(nodeObject, () => {