Log accept header for every request

This commit is contained in:
Alice Gaudon 2020-06-04 10:15:24 +02:00
parent 6a4b44035e
commit b85fbe6c21
3 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "wms-core",
"version": "0.4.34",
"version": "0.4.35",
"description": "Node web framework",
"repository": "git@gitlab.com:ArisuOngaku/wms-core.git",
"author": "Alice Gaudon <alice@gaudon.pro>",

View File

@ -64,7 +64,7 @@ export default abstract class Application {
let errorID: string;
let logStr = `${req.method} ${req.originalUrl} - `;
let logStr = `${req.method} ${req.originalUrl} Accept: ${req.accepts()} - `;
if (err instanceof BadRequestError || err instanceof ServiceUnavailableHttpError) {
logStr += `${err.errorCode} ${err.name}`;
errorID = Logger.silentError(err, logStr);

View File

@ -8,7 +8,7 @@ export default class LogRequestsComponent extends ApplicationComponent<void> {
router.use((req, res, next) => {
onFinished(res, (err) => {
if (!err) {
Logger.info(`${req.method} ${req.originalUrl} - ${res.statusCode}`);
Logger.info(`${req.method} ${req.originalUrl} Accept: ${req.accepts()} - ${res.statusCode}`);
}
});
next();