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:03:48 -07:00
parent c4c30d98d4
commit 785449a986
9 changed files with 41 additions and 41 deletions

View File

@@ -41,7 +41,7 @@ io.use(function (socket, next) {
});
io.on("connection", (socket) => {
socket.log_level = "TRACE";
socket.log_level = "DEBUG";
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, "TRACE", `Allocations calculated. ${JSON.stringify(allocations, null, 2)}`);
createLogEvent(socket, "DEBUG", `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, "TRACE", `Allocations calculated. ${JSON.stringify(allocations, null, 2)}`);
createLogEvent(socket, "DEBUG", `Allocations calculated. ${JSON.stringify(allocations, null, 2)}`);
callback(allocations);
});
@@ -103,7 +103,7 @@ io.on("connection", (socket) => {
socket.on("pbs-calculate-allocations-ap", async (billids, callback) => {
const allocations = await PbsCalculateAllocationsAp(socket, billids);
createLogEvent(socket, "DEBUG", `AP Allocations calculated.`);
createLogEvent(socket, "TRACE", `Allocations calculated. ${JSON.stringify(allocations, null, 2)}`);
createLogEvent(socket, "DEBUG", `Allocations calculated. ${JSON.stringify(allocations, null, 2)}`);
socket.apAllocations = allocations;
callback(allocations);
});
@@ -122,7 +122,7 @@ io.on("connection", (socket) => {
function createLogEvent(socket, level, message) {
if (LogLevelHierarchy(socket.log_level) >= LogLevelHierarchy(level)) {
// console.log(`[WS LOG EVENT] ${level} - ${new Date()} - ${socket.user.email} - ${socket.id} - ${message}`);
// console.log(`[WS LOG EVENT] ${level} - ${new Date()} - ${socket.user.email} - ${socket.id} - ${message}`);
socket.emit("log-event", {
timestamp: new Date(),
level,
@@ -173,17 +173,17 @@ function createJsonEvent(socket, level, message, json) {
}
function createXmlEvent(socket, xml, message, isError = false) {
if (LogLevelHierarchy(socket.log_level) >= LogLevelHierarchy("TRACE")) {
if (LogLevelHierarchy(socket.log_level) >= LogLevelHierarchy("DEBUG")) {
socket.emit("log-event", {
timestamp: new Date(),
level: isError ? "ERROR" : "TRACE",
level: isError ? "ERROR" : "DEBUG",
message: `${message}: ${xml}`
});
}
logger.log(
isError ? "ws-log-event-xml-error" : "ws-log-event-xml",
isError ? "ERROR" : "TRACE",
isError ? "ERROR" : "DEBUG",
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" : "TRACE",
level: isError ? "ERROR" : "DEBUG",
message,
xml
});
@@ -206,8 +206,6 @@ function LogLevelHierarchy(level) {
switch (level) {
case "XML":
return 5;
case "TRACE":
return 5;
case "DEBUG":
return 4;
case "INFO":