Skip to content

Commit

Permalink
Removed logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek Y committed Jun 14, 2024
1 parent 51a77b2 commit e19c75c
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/middlewares/schemaValidator.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ export const openApiValidatorMiddleware = async (
console.log(
`TMTR - ${req?.body?.context?.message_id} - ${req?.body?.context?.action} - GETMWARE - ${getConfig().app.mode}-${getConfig().app.gateway.mode} OPENAPI Val: ${timestampTracker.end - timestampTracker.start} ms`
);
const timestampTrackerWS = {
start: 0,
end: 0
};

const walkSubstack = function (
stack: any,
req: any,
Expand All @@ -198,28 +203,21 @@ export const openApiValidatorMiddleware = async (
if (typeof stack === "function") {
stack = [stack];
}
const walkStack = async function (i: any, err?: any) {
const walkStack = function (i: any, err?: any) {
if (err) {
return schemaErrorHandler(err, req, res, next);
}
const timestampTrackerWS = {
start: 0,
end: 0
};
console.log('value of i', i);
if (i >= stack.length) {
timestampTrackerWS.end = new Date().valueOf();
console.log(
`TMTR - ${req?.body?.context?.message_id} - ${req?.body?.context?.action} - WALK - ${getConfig().app.mode}-${getConfig().app.gateway.mode} OPENAPI Val: ${timestampTrackerWS.end - timestampTrackerWS.start} ms`
);
return next();
}
timestampTrackerWS.start = new Date().valueOf();
await stack[i](req, res, walkStack.bind(null, i + 1));
timestampTrackerWS.end = new Date().valueOf();
console.log(
`TMTR - ${req?.body?.context?.message_id} - ${req?.body?.context?.action} - WALK - ${getConfig().app.mode}-${getConfig().app.gateway.mode} OPENAPI Val: ${timestampTrackerWS.end - timestampTrackerWS.start} ms`
);
console.log('stack', stack);
stack[i](req, res, walkStack.bind(null, i + 1));
};
walkStack(0);
};

timestampTrackerWS.start = new Date().valueOf();
walkSubstack([...openApiValidator], req, res, next);
};

0 comments on commit e19c75c

Please sign in to comment.