Fix http requests logging
This commit is contained in:
parent
98566811c3
commit
a2ef0f6a42
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "wms-core",
|
||||
"version": "0.7.2",
|
||||
"version": "0.7.6",
|
||||
"description": "Node web framework",
|
||||
"repository": "git@gitlab.com:ArisuOngaku/wms-core.git",
|
||||
"author": "Alice Gaudon <alice@gaudon.pro>",
|
||||
@ -34,6 +34,7 @@
|
||||
"dependencies": {
|
||||
"@types/express": "^4.17.6",
|
||||
"@types/express-session": "^1.17.0",
|
||||
"@types/multer": "^1.4.3",
|
||||
"@types/mysql": "^2.15.10",
|
||||
"@types/nodemailer": "^6.4.0",
|
||||
"@types/nunjucks": "^3.1.3",
|
||||
|
@ -16,7 +16,7 @@ export default class LogRequestsComponent extends ApplicationComponent<void> {
|
||||
let logStr = `${req.method} ${req.originalUrl} - ${res.statusCode}`;
|
||||
if (err) {
|
||||
if (silent) {
|
||||
logStr += `${err.errorCode} ${err.name}`;
|
||||
logStr += ` ${err.errorCode} ${err.name}`;
|
||||
return Logger.silentError(err, logStr);
|
||||
} else {
|
||||
return Logger.error(err, logStr, additionalStr, err);
|
||||
@ -25,7 +25,7 @@ export default class LogRequestsComponent extends ApplicationComponent<void> {
|
||||
Logger.info(logStr);
|
||||
}
|
||||
} else {
|
||||
const requestObj = {
|
||||
const requestObj = JSON.stringify({
|
||||
ip: req.ip,
|
||||
host: req.hostname,
|
||||
method: req.method,
|
||||
@ -34,12 +34,13 @@ export default class LogRequestsComponent extends ApplicationComponent<void> {
|
||||
query: req.query,
|
||||
params: req.params,
|
||||
body: req.body,
|
||||
files: req.files,
|
||||
cookies: req.cookies,
|
||||
sessionId: req.sessionID,
|
||||
result: {
|
||||
code: res.statusCode
|
||||
}
|
||||
};
|
||||
}, null, 4);
|
||||
if (err) {
|
||||
return Logger.error(err, requestObj, err);
|
||||
} else {
|
||||
|
@ -641,6 +641,13 @@
|
||||
resolved "https://registry.toot.party/@types%2fmjml/-/mjml-4.0.4.tgz#af6075d29f64d47186d76125504daf544dfb2b42"
|
||||
integrity sha512-4PhI6iZ1zGXZ9X9W0bbmI7mS2xdxITURueqSWJ/cTeS5+tbAtOUDG1ww/fPbfcffWwR4NeOjyNcZiczafH/yfw==
|
||||
|
||||
"@types/multer@^1.4.3":
|
||||
version "1.4.3"
|
||||
resolved "https://registry.toot.party/@types%2fmulter/-/multer-1.4.3.tgz#bdff74b334c38a8ee1de9fbedb5d1d3dbc377422"
|
||||
integrity sha512-tWsKbF5LYtXrJ7eOfI0aLBgEv9B7fnJe1JRXTj5+Z6EMfX0yHVsRFsNGnKyN8Bs0gtDv+JR37xAqsPnALyVTqg==
|
||||
dependencies:
|
||||
"@types/express" "*"
|
||||
|
||||
"@types/mysql@^2.15.10":
|
||||
version "2.15.13"
|
||||
resolved "https://registry.toot.party/@types%2fmysql/-/mysql-2.15.13.tgz#153dc2e2f8dffd39f7bba556c2679f14bdbecde1"
|
||||
|
Loading…
Reference in New Issue
Block a user