Skip to content

Commit 4b160ab

Browse files
committed
chore: add request id log
1 parent 49d4678 commit 4b160ab

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app-routes.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
const _ = require("lodash");
66
const config = require("config");
77
const HttpStatus = require("http-status-codes");
8+
const uuid = require("uuid/v4");
89
const helper = require("./src/common/helper");
910
const errors = require("./src/common/errors");
11+
const logger = require("./src/common/logger");
1012
const routes = require("./src/routes");
1113
const authenticator = require("tc-core-library-js").middleware.jwtAuthenticator;
1214

@@ -26,7 +28,9 @@ module.exports = (app) => {
2628

2729
const actions = [];
2830
actions.push((req, res, next) => {
29-
req.signature = `${def.controller}#${def.method}`;
31+
req._id = uuid();
32+
req.signature = `${req._id}-${def.controller}#${def.method}`;
33+
logger.info(`Started request handling, ${req.signature}`);
3034
next();
3135
});
3236

0 commit comments

Comments
 (0)