status codes

This commit is contained in:
Erik 2022-11-10 17:59:41 +02:00
parent f324587860
commit f8fcb5a5d4
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -118,7 +118,7 @@ class Server extends EventEmitter {
logRequest (req, res, next) {
res.once('finish', () => {
this.logger[res.statusCode === 401 ? 'unauthorised' : 'access'](`[${req.get('X-Forwarded-For') || req.socket.remoteAddress}] [STATUS: ${res.statusCode}] Request to ${req.route?.path || req.path}`);
this.logger[[ 401, 403 ].includes(res.statusCode) ? 'unauthorised' : 'access'](`[${req.get('X-Forwarded-For') || req.socket.remoteAddress}] [STATUS: ${res.statusCode}] Request to ${req.route?.path || req.path}`);
});
next();
}