Log accept header for every request
This commit is contained in:
parent
6a4b44035e
commit
b85fbe6c21
@ -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>",
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user