Log accept header for every request
This commit is contained in:
parent
6a4b44035e
commit
b85fbe6c21
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "wms-core",
|
"name": "wms-core",
|
||||||
"version": "0.4.34",
|
"version": "0.4.35",
|
||||||
"description": "Node web framework",
|
"description": "Node web framework",
|
||||||
"repository": "git@gitlab.com:ArisuOngaku/wms-core.git",
|
"repository": "git@gitlab.com:ArisuOngaku/wms-core.git",
|
||||||
"author": "Alice Gaudon <alice@gaudon.pro>",
|
"author": "Alice Gaudon <alice@gaudon.pro>",
|
||||||
|
@ -64,7 +64,7 @@ export default abstract class Application {
|
|||||||
|
|
||||||
let errorID: string;
|
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) {
|
if (err instanceof BadRequestError || err instanceof ServiceUnavailableHttpError) {
|
||||||
logStr += `${err.errorCode} ${err.name}`;
|
logStr += `${err.errorCode} ${err.name}`;
|
||||||
errorID = Logger.silentError(err, logStr);
|
errorID = Logger.silentError(err, logStr);
|
||||||
|
@ -8,7 +8,7 @@ export default class LogRequestsComponent extends ApplicationComponent<void> {
|
|||||||
router.use((req, res, next) => {
|
router.use((req, res, next) => {
|
||||||
onFinished(res, (err) => {
|
onFinished(res, (err) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
Logger.info(`${req.method} ${req.originalUrl} - ${res.statusCode}`);
|
Logger.info(`${req.method} ${req.originalUrl} Accept: ${req.accepts()} - ${res.statusCode}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
next();
|
next();
|
||||||
|
Loading…
Reference in New Issue
Block a user