fix(api-gateway): add request method to the debug logs

This commit is contained in:
Karol Sójko 2023-11-13 11:15:02 +01:00
parent f6ec8626e5
commit b39eb09d91
No known key found for this signature in database
GPG key ID: C2F813669419D05F

View file

@ -91,11 +91,13 @@ void container.load().then((container) => {
server.setErrorConfig((app) => {
app.use((error: Record<string, unknown>, request: Request, response: Response, _next: NextFunction) => {
logger.error(`[URL: ${request.url}][SNJS: ${request.headers['x-snjs-version']}] Error thrown: ${error.stack}`)
logger.error(
`[URL: |${request.method}| ${request.url}][SNJS: ${request.headers['x-snjs-version']}] Error thrown: ${error.stack}`,
)
logger.debug(
`[URL: ${request.url}][SNJS: ${request.headers['x-snjs-version']}] Request body: ${JSON.stringify(
request.body,
)}`,
`[URL: |${request.method}| ${request.url}][SNJS: ${
request.headers['x-snjs-version']
}] Request body: ${JSON.stringify(request.body)}`,
)
response.status(500).send({