mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
Merge remote-tracking branch 'refs/remotes/upstream/master'
Conflicts: lib/appenders/gelf.js lib/connect-logger.js
This commit is contained in:
commit
50ce5030df
@ -114,11 +114,11 @@ function gelfAppender(layout, host, port, hostname, facility) {
|
||||
}
|
||||
|
||||
function sendPacket(packet) {
|
||||
try {
|
||||
client.send(packet, 0, packet.length, port, host);
|
||||
} catch (e) {
|
||||
// do nothing
|
||||
}
|
||||
client.send(packet, 0, packet.length, port, host, err => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return loggingEvent => {
|
||||
|
||||
@ -135,7 +135,7 @@ function assembleTokens(req, res, customTokens) {
|
||||
};
|
||||
|
||||
const defaultTokens = [];
|
||||
defaultTokens.push({ token: ':url', replacement: req.originalUrl });
|
||||
defaultTokens.push({ token: ':url', replacement: getUrl(req) });
|
||||
defaultTokens.push({ token: ':protocol', replacement: req.protocol });
|
||||
defaultTokens.push({ token: ':hostname', replacement: req.hostname });
|
||||
defaultTokens.push({ token: ':method', replacement: req.method });
|
||||
@ -186,6 +186,20 @@ function assembleTokens(req, res, customTokens) {
|
||||
return arrayUniqueTokens(customTokens.concat(defaultTokens));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "log4js",
|
||||
"version": "0.6.37",
|
||||
"version": "0.6.38",
|
||||
"description": "Port of Log4js to work with node.",
|
||||
"keywords": [
|
||||
"logging",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user