mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
add req.url so that connect works with restify
This commit is contained in:
parent
b55eb70d03
commit
bcc3d4630f
@ -128,7 +128,7 @@ function assemble_tokens(req, res, custom_tokens) {
|
||||
};
|
||||
|
||||
var default_tokens = [];
|
||||
default_tokens.push({ token: ':url', replacement: req.originalUrl || req.url });
|
||||
default_tokens.push({ token: ':url', replacement: getUrl(req) });
|
||||
default_tokens.push({ token: ':protocol', replacement: req.protocol });
|
||||
default_tokens.push({ token: ':hostname', replacement: req.hostname });
|
||||
default_tokens.push({ token: ':method', replacement: req.method });
|
||||
@ -177,6 +177,18 @@ function assemble_tokens(req, res, custom_tokens) {
|
||||
return array_unique_tokens(custom_tokens.concat(default_tokens));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return request url path,
|
||||
* adding this function prevents the Cyclomatic Complexity for the assemble_tokens function at low, to pass the tests.
|
||||
*
|
||||
* @param {IncomingMessage} req
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function getUrl(req){
|
||||
return req.originalUrl || req.url
|
||||
}
|
||||
/**
|
||||
* Return formatted log line.
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user