Skip to content

Commit

Permalink
chore: Add temporary debug logging for each executeRoute
Browse files Browse the repository at this point in the history
  • Loading branch information
msarcev committed Nov 21, 2023
1 parent b457763 commit d707193
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions api/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-require-imports */
import compression from "compression";
import { randomUUID } from "crypto";
import * as dotenv from "dotenv";
dotenv.config();
import express, { Application } from "express";
Expand Down Expand Up @@ -69,19 +70,25 @@ app.use((req, res, next) => {
res,
allowedDomains,
allowedMethods,
allowedHeaders);
allowedHeaders
);
next();
});

for (const route of routes) {
app[route.method](route.path, async (req, res) => {
const uuid = randomUUID();
const start = Date.now();
logger.debug(`Executing route: '${route.path}' uuid: '${uuid}'`);
await executeRoute(
req,
res,
config,
route,
req.params,
config.verboseLogging);
config.verboseLogging
);
logger.debug(`Finished route uuid: '${uuid}' took: ${Date.now() - start}ms`);
});
}

Expand Down

0 comments on commit d707193

Please sign in to comment.