logging: add status code description for redirections
This commit is contained in:
parent
878f706f82
commit
2c66c66a39
@ -46,7 +46,14 @@ export default class LogRequestsComponent extends ApplicationComponent {
|
||||
req.log.info(requestObj);
|
||||
}
|
||||
} else {
|
||||
let logStr = `${req.ip} < ${req.method} ${req.originalUrl} - ${res.statusCode}`;
|
||||
let codeDescription = '';
|
||||
if (res.statusCode === 301) {
|
||||
codeDescription = 'Permanent redirect to ' + res.getHeader('location');
|
||||
} else if (res.statusCode === 302) {
|
||||
codeDescription = 'Temporary redirect to ' + res.getHeader('location');
|
||||
}
|
||||
|
||||
let logStr = `${req.ip} < ${req.method} ${req.originalUrl} - ${res.statusCode} ${codeDescription}`;
|
||||
if (err) {
|
||||
if (err instanceof Error) {
|
||||
if (silent) {
|
||||
|
Loading…
Reference in New Issue
Block a user