add middleware writeLog

This commit is contained in:
joseph le 2023-09-29 15:17:58 +07:00
parent bddb56f41f
commit cb9a7643d2
2 changed files with 87 additions and 2 deletions

View File

@ -8,7 +8,8 @@ export default class Logger {
) {
// code for middleware goes here. ABOVE THE NEXT CALL
await next();
loggerAPI(request, response, request.url());
let a = request,
let b = response
loggerAPI(a, b, request.url());
}
}

View File

@ -0,0 +1,84 @@
[29/9/23-15:15:28] - 200 - /api/getParagraph
------PAYLOAD------
{
"fileName": "20230928-HELEN1-Session.US2-14-6-127.0.0.1.log",
"line": 1128,
"range": 100
}
------PARAMS-------
{}
-----RESPONSE------
{
"content": "$ (c) of the Commercial Computer Software - Restricted\r\n$ Rights clause at FAR sec. 52.227-19 and subparagraph\r\n$ (c) (1) (ii) of the Rights in Technical Data and Computer\r\n$ Software clause at DFARS sec. 252.227-7013.\r\n$ \r\n$ cisco Systems, Inc.\r\n$ 170 West Tasman Drive\r"
}
------HEADERS------
{
"content-length": "98",
"accept-encoding": "gzip, deflate, br",
"accept": "application/json",
"user-agent": "Thunder Client (https://www.thunderclient.com)",
"authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZF91c2VyIjoxLCJ1c2VybmFtZSI6ImVycHVzZXIiLCJjcmVhdGVkQXQiOiIyMDIzLTA4LTIzVDE1OjI4OjAxLjAwMCsxMDowMCIsInVwZGF0ZWRBdCI6IjIwMjMtMDgtMjNUMTU6Mjg6MDEuMDAwKzEwOjAwIiwiaWF0IjoxNjk1MzY0OTYxLCJleHAiOjE3MjY5MDA5NjF9.7IZbp-PRtgutV_AWA7Uf0ljHBJyfczPbJKiD5KO2bjM",
"content-type": "application/json",
"host": "localhost:3333",
"connection": "close"
}
======================================================================
[29/9/23-15:15:45] - 200 - /api/getParagraph
------PAYLOAD------
{
"fileName": "20230928-HELEN1-Session.US2-14-6-127.0.0.1.log",
"line": 1128,
"range": 100
}
------PARAMS-------
{}
-----RESPONSE------
{
"content": "$ (c) of the Commercial Computer Software - Restricted\r\n$ Rights clause at FAR sec. 52.227-19 and subparagraph\r\n$ (c) (1) (ii) of the Rights in Technical Data and Computer\r\n$ Software clause at DFARS sec. 252.227-7013.\r\n$ \r\n$ cisco Systems, Inc.\r\n$ 170 West Tasman Drive\r"
}
------HEADERS------
{
"content-length": "98",
"accept-encoding": "gzip, deflate, br",
"cookie": "adonis-session=s%3AeyJtZXNzYWdlIjoiY2xuNGJ4MHlqMDAwMG9vbmEzZTRkZDJzcSIsInB1cnBvc2UiOiJhZG9uaXMtc2Vzc2lvbiJ9.UQ0lXBkz2MInbMKzqt2diepk3Da7CDS2fAYbUhJx7-Q; cln4bx0yj0000oona3e4dd2sq=e%3A1CWpFAPcV7y9-qpYpR359aUP8iQOnnBbf6JOIHjmJfLEeBmWUvdREsDpC8jyvK4t3brnP17YkPFLHUW4LSBtnA.ekxkNk5ueDJJbGFXNW5EQQ.kOlFj953FhJ9XqkeZJkmVKp10HwXtubgZMfAlIjT-ug",
"accept": "application/json",
"user-agent": "Thunder Client (https://www.thunderclient.com)",
"authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZF91c2VyIjoxLCJ1c2VybmFtZSI6ImVycHVzZXIiLCJjcmVhdGVkQXQiOiIyMDIzLTA4LTIzVDE1OjI4OjAxLjAwMCsxMDowMCIsInVwZGF0ZWRBdCI6IjIwMjMtMDgtMjNUMTU6Mjg6MDEuMDAwKzEwOjAwIiwiaWF0IjoxNjk1MzY0OTYxLCJleHAiOjE3MjY5MDA5NjF9.7IZbp-PRtgutV_AWA7Uf0ljHBJyfczPbJKiD5KO2bjM",
"content-type": "application/json",
"host": "localhost:3333",
"connection": "close"
}
======================================================================
[29/9/23-15:15:47] - 200 - /api/getParagraph
------PAYLOAD------
{
"fileName": "20230928-HELEN1-Session.US2-14-6-127.0.0.1.log",
"line": 1128,
"range": 100
}
------PARAMS-------
{}
-----RESPONSE------
{
"content": "$ (c) of the Commercial Computer Software - Restricted\r\n$ Rights clause at FAR sec. 52.227-19 and subparagraph\r\n$ (c) (1) (ii) of the Rights in Technical Data and Computer\r\n$ Software clause at DFARS sec. 252.227-7013.\r\n$ \r\n$ cisco Systems, Inc.\r\n$ 170 West Tasman Drive\r"
}
------HEADERS------
{
"content-length": "98",
"accept-encoding": "gzip, deflate, br",
"cookie": "adonis-session=s%3AeyJtZXNzYWdlIjoiY2xuNGJ4MHlqMDAwMG9vbmEzZTRkZDJzcSIsInB1cnBvc2UiOiJhZG9uaXMtc2Vzc2lvbiJ9.UQ0lXBkz2MInbMKzqt2diepk3Da7CDS2fAYbUhJx7-Q; cln4bx0yj0000oona3e4dd2sq=e%3AukqpM6Tq1-oRkCAInVYicUmDIkpFoB21opHGGfMRRPyv8xPVhPdwIyET7i4inDrkdji2GAC5p8Dm27ULMYFOsw.OWNvbnk5Y0ZwYzU5bWhTQg.qxI-LCelxLU07qTGDcNcYih7qCg0t54VmpNgy4fdO3c",
"accept": "application/json",
"user-agent": "Thunder Client (https://www.thunderclient.com)",
"authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZF91c2VyIjoxLCJ1c2VybmFtZSI6ImVycHVzZXIiLCJjcmVhdGVkQXQiOiIyMDIzLTA4LTIzVDE1OjI4OjAxLjAwMCsxMDowMCIsInVwZGF0ZWRBdCI6IjIwMjMtMDgtMjNUMTU6Mjg6MDEuMDAwKzEwOjAwIiwiaWF0IjoxNjk1MzY0OTYxLCJleHAiOjE3MjY5MDA5NjF9.7IZbp-PRtgutV_AWA7Uf0ljHBJyfczPbJKiD5KO2bjM",
"content-type": "application/json",
"host": "localhost:3333",
"connection": "close"
}
======================================================================