release/2024-11-01 - Remove Trace Log Level

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-10-28 12:24:40 -07:00
parent 785449a986
commit 79ed6f2388
9 changed files with 35 additions and 29 deletions

View File

@@ -41,7 +41,7 @@ io.use(function (socket, next) {
});
io.on("connection", (socket) => {
socket.log_level = "DEBUG";
socket.log_level = "SILLY";
createLogEvent(socket, "DEBUG", `Connected and Authenticated.`);
socket.on("set-log-level", (level) => {
@@ -75,7 +75,7 @@ io.on("connection", (socket) => {
socket.on("cdk-calculate-allocations", async (jobid, callback) => {
const allocations = await CdkCalculateAllocations(socket, jobid);
createLogEvent(socket, "DEBUG", `Allocations calculated.`);
createLogEvent(socket, "DEBUG", `Allocations calculated. ${JSON.stringify(allocations, null, 2)}`);
createLogEvent(socket, "SILLY", `Allocations calculated. ${JSON.stringify(allocations, null, 2)}`);
callback(allocations);
});
@@ -85,7 +85,7 @@ io.on("connection", (socket) => {
socket.on("pbs-calculate-allocations", async (jobid, callback) => {
const allocations = await CdkCalculateAllocations(socket, jobid);
createLogEvent(socket, "DEBUG", `Allocations calculated.`);
createLogEvent(socket, "DEBUG", `Allocations calculated. ${JSON.stringify(allocations, null, 2)}`);
createLogEvent(socket, "SILLY", `Allocations calculated. ${JSON.stringify(allocations, null, 2)}`);
callback(allocations);
});
@@ -173,17 +173,17 @@ function createJsonEvent(socket, level, message, json) {
}
function createXmlEvent(socket, xml, message, isError = false) {
if (LogLevelHierarchy(socket.log_level) >= LogLevelHierarchy("DEBUG")) {
if (LogLevelHierarchy(socket.log_level) >= LogLevelHierarchy("SILLY")) {
socket.emit("log-event", {
timestamp: new Date(),
level: isError ? "ERROR" : "DEBUG",
level: isError ? "ERROR" : "SILLY",
message: `${message}: ${xml}`
});
}
logger.log(
isError ? "ws-log-event-xml-error" : "ws-log-event-xml",
isError ? "ERROR" : "DEBUG",
isError ? "ERROR" : "SILLY",
socket.user.email,
socket.recordid,
{
@@ -195,7 +195,7 @@ function createXmlEvent(socket, xml, message, isError = false) {
if (socket.logEvents && isArray(socket.logEvents)) {
socket.logEvents.push({
timestamp: new Date(),
level: isError ? "ERROR" : "DEBUG",
level: isError ? "ERROR" : "SILLY",
message,
xml
});
@@ -206,6 +206,8 @@ function LogLevelHierarchy(level) {
switch (level) {
case "XML":
return 5;
case "SILLY":
return 5;
case "DEBUG":
return 4;
case "INFO":