From 79ed6f238854880d8d773d15ecc26418816e03fb Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Mon, 28 Oct 2024 12:24:40 -0700 Subject: [PATCH] release/2024-11-01 - Remove Trace Log Level Signed-off-by: Dave Richer --- .../dms-log-events.component.jsx | 2 ++ .../dms-payables/dms-payables.container.jsx | 1 + client/src/pages/dms/dms.container.jsx | 1 + server/accounting/pbs/pbs-ap-allocations.js | 6 ++--- server/accounting/pbs/pbs-job-export.js | 8 +++--- server/cdk/cdk-calculate-allocations.js | 2 +- server/cdk/cdk-job-export.js | 26 +++++++++---------- server/ioevent/ioevent.js | 2 +- server/web-sockets/web-socket.js | 16 +++++++----- 9 files changed, 35 insertions(+), 29 deletions(-) diff --git a/client/src/components/dms-log-events/dms-log-events.component.jsx b/client/src/components/dms-log-events/dms-log-events.component.jsx index 9391d8edb..c3e46a877 100644 --- a/client/src/components/dms-log-events/dms-log-events.component.jsx +++ b/client/src/components/dms-log-events/dms-log-events.component.jsx @@ -40,6 +40,8 @@ export function DmsLogEvents({ socket, logs, bodyshop }) { function LogLevelHierarchy(level) { switch (level) { + case "SILLY": + return "pink"; case "DEBUG": return "orange"; case "INFO": diff --git a/client/src/pages/dms-payables/dms-payables.container.jsx b/client/src/pages/dms-payables/dms-payables.container.jsx index 47659cd9b..e81597bed 100644 --- a/client/src/pages/dms-payables/dms-payables.container.jsx +++ b/client/src/pages/dms-payables/dms-payables.container.jsx @@ -123,6 +123,7 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) { socket.emit("set-log-level", value); }} > + SILLY DEBUG INFO WARNING diff --git a/client/src/pages/dms/dms.container.jsx b/client/src/pages/dms/dms.container.jsx index 3f7569cbd..f05eae615 100644 --- a/client/src/pages/dms/dms.container.jsx +++ b/client/src/pages/dms/dms.container.jsx @@ -173,6 +173,7 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse socket.emit("set-log-level", value); }} > + SILLY DEBUG INFO WARNING diff --git a/server/accounting/pbs/pbs-ap-allocations.js b/server/accounting/pbs/pbs-ap-allocations.js index 49d11eaa0..a969e82c8 100644 --- a/server/accounting/pbs/pbs-ap-allocations.js +++ b/server/accounting/pbs/pbs-ap-allocations.js @@ -26,7 +26,7 @@ axios.interceptors.request.use((x) => { } | ${JSON.stringify(x.data)} | ${JSON.stringify(headers)}`; //console.log(printable); - CdkBase.createJsonEvent(socket, "DEBUG", `Raw Request: ${printable}`, x.data); + CdkBase.createJsonEvent(socket, "SILLY", `Raw Request: ${printable}`, x.data); return x; }); @@ -36,7 +36,7 @@ axios.interceptors.response.use((x) => { const printable = `${new Date()} | Response: ${x.status} | ${JSON.stringify(x.data)}`; //console.log(printable); - CdkBase.createJsonEvent(socket, "DEBUG", `Raw Response: ${printable}`, x.data); + CdkBase.createJsonEvent(socket, "SILLY", `Raw Response: ${printable}`, x.data); return x; }); @@ -181,7 +181,7 @@ async function QueryBillData(socket, billids) { const result = await client .setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` }) .request(queries.GET_PBS_AP_ALLOCATIONS, { billids: billids }); - CdkBase.createLogEvent(socket, "DEBUG", `Bill data query result ${JSON.stringify(result, null, 2)}`); + CdkBase.createLogEvent(socket, "SILLY", `Bill data query result ${JSON.stringify(result, null, 2)}`); return result; } diff --git a/server/accounting/pbs/pbs-job-export.js b/server/accounting/pbs/pbs-job-export.js index 9ea3e1f91..c2f6b96b7 100644 --- a/server/accounting/pbs/pbs-job-export.js +++ b/server/accounting/pbs/pbs-job-export.js @@ -28,7 +28,7 @@ axios.interceptors.request.use((x) => { } | ${JSON.stringify(x.data)} | ${JSON.stringify(headers)}`; //console.log(printable); - CdkBase.createJsonEvent(socket, "DEBUG", `Raw Request: ${printable}`, x.data); + CdkBase.createJsonEvent(socket, "SILLY", `Raw Request: ${printable}`, x.data); return x; }); @@ -38,7 +38,7 @@ axios.interceptors.response.use((x) => { const printable = `${new Date()} | Response: ${x.status} | ${JSON.stringify(x.data)}`; //console.log(printable); - CdkBase.createJsonEvent(socket, "DEBUG", `Raw Response: ${printable}`, x.data); + CdkBase.createJsonEvent(socket, "SILLY", `Raw Response: ${printable}`, x.data); return x; }); @@ -118,7 +118,7 @@ async function CheckForErrors(socket, response) { CdkBase.createLogEvent(socket, "DEBUG", `Successful response from DMS. ${response.Message || ""}`); } else { CdkBase.createLogEvent(socket, "ERROR", `Error received from DMS: ${response.Message}`); - CdkBase.createLogEvent(socket, "DEBUG", `Error received from DMS: ${JSON.stringify(response)}`); + CdkBase.createLogEvent(socket, "SILLY", `Error received from DMS: ${JSON.stringify(response)}`); } } @@ -130,7 +130,7 @@ async function QueryJobData(socket, jobid) { const result = await client .setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` }) .request(queries.QUERY_JOBS_FOR_PBS_EXPORT, { id: jobid }); - CdkBase.createLogEvent(socket, "DEBUG", `Job data query result ${JSON.stringify(result, null, 2)}`); + CdkBase.createLogEvent(socket, "SILLY", `Job data query result ${JSON.stringify(result, null, 2)}`); return result.jobs_by_pk; } diff --git a/server/cdk/cdk-calculate-allocations.js b/server/cdk/cdk-calculate-allocations.js index 82610dcb3..f78c48b91 100644 --- a/server/cdk/cdk-calculate-allocations.js +++ b/server/cdk/cdk-calculate-allocations.js @@ -42,7 +42,7 @@ async function QueryJobData(connectionData, token, jobid) { CdkBase.createLogEvent(connectionData, "DEBUG", `Querying job data for id ${jobid}`); const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {}); const result = await client.setHeaders({ Authorization: token }).request(queries.GET_CDK_ALLOCATIONS, { id: jobid }); - CdkBase.createLogEvent(connectionData, "DEBUG", `Job data query result ${JSON.stringify(result, null, 2)}`); + CdkBase.createLogEvent(connectionData, "SILLY", `Job data query result ${JSON.stringify(result, null, 2)}`); return result.jobs_by_pk; } diff --git a/server/cdk/cdk-job-export.js b/server/cdk/cdk-job-export.js index ec7d355b5..7fedbc608 100644 --- a/server/cdk/cdk-job-export.js +++ b/server/cdk/cdk-job-export.js @@ -151,7 +151,7 @@ async function QueryJobData(socket, jobid) { const result = await client .setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` }) .request(queries.QUERY_JOBS_FOR_CDK_EXPORT, { id: jobid }); - CdkBase.createLogEvent(socket, "DEBUG", `Job data query result ${JSON.stringify(result, null, 2)}`); + CdkBase.createLogEvent(socket, "SILLY", `Job data query result ${JSON.stringify(result, null, 2)}`); return result.jobs_by_pk; } @@ -171,7 +171,7 @@ async function CalculateDmsVid(socket, JobData) { CdkBase.createLogEvent( socket, - "DEBUG", + "SILLY", `soapClientVehicleInsertUpdate.getVehIdsAsync Result ${JSON.stringify(result, null, 2)}` ); CheckCdkResponseForError(socket, soapResponseVehicleInsertUpdate); @@ -214,7 +214,7 @@ async function QueryDmsVehicleById(socket, JobData, DMSVid) { CdkBase.createLogEvent( socket, - "DEBUG", + "SILLY", `soapClientVehicleInsertUpdate.readAsync Result ${JSON.stringify(result, null, 2)}` ); CdkBase.createXmlEvent(socket, rawResponse, `soapClientVehicleInsertUpdate.readAsync response.`); @@ -246,7 +246,7 @@ async function QueryDmsCustomerById(socket, JobData, CustomerId) { CdkBase.createXmlEvent(socket, rawResponse, `soapClientCustomerInsertUpdate.readAsync response.`); CdkBase.createLogEvent( socket, - "DEBUG", + "SILLY", `soapClientCustomerInsertUpdate.readAsync Result ${JSON.stringify(result, null, 2)}` ); CheckCdkResponseForError(socket, soapResponseCustomerInsertUpdate); @@ -295,7 +295,7 @@ async function QueryDmsCustomerByName(socket, JobData) { CdkBase.createLogEvent( socket, - "DEBUG", + "SILLY", `soapClientCustomerSearch.executeSearchBulkAsync Result ${JSON.stringify(result, null, 2)}` ); CheckCdkResponseForError(socket, soapResponseCustomerSearch); @@ -337,7 +337,7 @@ async function GenerateDmsCustomerNumber(socket) { CdkBase.createLogEvent( socket, - "DEBUG", + "SILLY", `soapClientCustomerInsertUpdate.getCustomerNumberAsync Result ${JSON.stringify(result, null, 2)}` ); CheckCdkResponseForError(socket, soapResponseCustomerInsertUpdate); @@ -425,7 +425,7 @@ async function InsertDmsCustomer(socket, newCustomerNumber) { CdkBase.createXmlEvent(socket, rawResponse, `soapClientCustomerInsertUpdate.insertAsync response.`); CdkBase.createLogEvent( socket, - "DEBUG", + "SILLY", `soapClientCustomerInsertUpdate.insertAsync Result ${JSON.stringify(result, null, 2)}` ); CheckCdkResponseForError(socket, soapResponseCustomerInsertUpdate); @@ -505,7 +505,7 @@ async function InsertDmsVehicle(socket) { CdkBase.createLogEvent( socket, - "DEBUG", + "SILLY", `soapClientVehicleInsertUpdate.insertAsync Result ${JSON.stringify(result, null, 2)}` ); CdkBase.createXmlEvent(socket, rawResponse, `soapClientVehicleInsertUpdate.insertAsync response.`); @@ -650,7 +650,7 @@ async function InsertServiceVehicleHistory(socket) { CdkBase.createLogEvent( socket, - "DEBUG", + "SILLY", `soapClientServiceHistoryInsert.serviceHistoryHeaderInsert Result ${JSON.stringify(result, null, 2)}` ); CdkBase.createXmlEvent(socket, rawResponse, `soapClientServiceHistoryInsert.serviceHistoryHeaderInsert response.`); @@ -690,7 +690,7 @@ async function InsertDmsStartWip(socket) { CdkBase.createLogEvent( socket, - "DEBUG", + "SILLY", `soapClientAccountingGLInsertUpdate.doStartWIPAsync Result ${JSON.stringify(result, null, 2)}` ); CdkBase.createXmlEvent(socket, rawResponse, `soapClientAccountingGLInsertUpdate.doStartWIPAsync response.`); @@ -721,7 +721,7 @@ async function InsertDmsBatchWip(socket) { CdkBase.createLogEvent( socket, - "DEBUG", + "SILLY", `soapClientAccountingGLInsertUpdate.doTransBatchWIPAsync Result ${JSON.stringify(result, null, 2)}` ); CdkBase.createXmlEvent(socket, rawResponse, `soapClientAccountingGLInsertUpdate.doTransBatchWIPAsync response.`); @@ -885,7 +885,7 @@ async function PostDmsBatchWip(socket) { CdkBase.createLogEvent( socket, - "DEBUG", + "SILLY", `soapClientAccountingGLInsertUpdate.doPostBatchWIPAsync Result ${JSON.stringify(result, null, 2)}` ); CdkBase.createXmlEvent(socket, rawResponse, `soapClientAccountingGLInsertUpdate.doPostBatchWIPAsync response.`); @@ -945,7 +945,7 @@ async function DeleteDmsWip(socket) { CdkBase.createLogEvent( socket, - "DEBUG", + "SILLY", `soapClientAccountingGLInsertUpdate.doPostBatchWIPAsync Result ${JSON.stringify(result, null, 2)}` ); CdkBase.createXmlEvent(socket, rawResponse, `soapClientAccountingGLInsertUpdate.doPostBatchWIPAsync response.`); diff --git a/server/ioevent/ioevent.js b/server/ioevent/ioevent.js index 914c15c54..6ca37f27e 100644 --- a/server/ioevent/ioevent.js +++ b/server/ioevent/ioevent.js @@ -35,7 +35,7 @@ exports.default = async (req, res) => { res.sendStatus(200); } catch (error) { - logger.log("ioevent-error", "debug", user, null, { + logger.log("ioevent-error", "silly", user, null, { operationname: operationName, time, dbevent, diff --git a/server/web-sockets/web-socket.js b/server/web-sockets/web-socket.js index bd6147d36..6b14503d8 100644 --- a/server/web-sockets/web-socket.js +++ b/server/web-sockets/web-socket.js @@ -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":