Comparing version 4.0.2 to 4.1.0
'use strict'; | ||
// eslint-disable-next-line no-console | ||
const consoleLog = console.log.bind(console); | ||
@@ -4,0 +5,0 @@ |
@@ -74,3 +74,4 @@ 'use strict'; | ||
return 1; | ||
} else if (index(a) < index(b)) { | ||
} | ||
if (index(a) < index(b)) { | ||
return -1; | ||
@@ -77,0 +78,0 @@ } |
@@ -34,7 +34,7 @@ const path = require('path'); | ||
const loadAppenderModule = (type, config) => coreAppenders.get(type) || | ||
tryLoading(`./${type}`, config) || | ||
tryLoading(type, config) || | ||
(require.main && tryLoading(path.join(path.dirname(require.main.filename), type), config)) || | ||
tryLoading(path.join(process.cwd(), type), config); | ||
const loadAppenderModule = (type, config) => coreAppenders.get(type) | ||
|| tryLoading(`./${type}`, config) | ||
|| tryLoading(type, config) | ||
|| (require.main && tryLoading(path.join(path.dirname(require.main.filename), type), config)) | ||
|| tryLoading(path.join(process.cwd(), type), config); | ||
@@ -41,0 +41,0 @@ const createAppender = (name, config) => { |
@@ -30,4 +30,4 @@ 'use strict'; | ||
const regex = new RegExp(filters.join('|'), 'i'); | ||
if (filters.length === 0 || | ||
logEvent.data.findIndex(value => regex.test(value)) < 0) { | ||
if (filters.length === 0 | ||
|| logEvent.data.findIndex(value => regex.test(value)) < 0) { | ||
debug('Not excluded, sending to appender'); | ||
@@ -34,0 +34,0 @@ appender(logEvent); |
@@ -0,5 +1,5 @@ | ||
const debug = require('debug')('log4js:categories'); | ||
const configuration = require('./configuration'); | ||
const levels = require('./levels'); | ||
const appenders = require('./appenders'); | ||
const debug = require('debug')('log4js:categories'); | ||
@@ -56,4 +56,4 @@ const categories = new Map(); | ||
configuration.not(levels.getLevel(category.level)), | ||
`category "${name}" is not valid (level "${category.level}" not recognised;` + | ||
` valid levels are ${levels.levels.join(', ')})` | ||
`category "${name}" is not valid (level "${category.level}" not recognised;` | ||
+ ` valid levels are ${levels.levels.join(', ')})` | ||
); | ||
@@ -112,4 +112,4 @@ }); | ||
const sourceCategoryConfig = configForCategory(category); | ||
debug('setLevelForCategory: no config found for category, ' + | ||
`found ${sourceCategoryConfig} for parents of ${category}`); | ||
debug('setLevelForCategory: no config found for category, ' | ||
+ `found ${sourceCategoryConfig} for parents of ${category}`); | ||
categoryConfig = { appenders: sourceCategoryConfig.appenders }; | ||
@@ -116,0 +116,0 @@ } |
@@ -0,5 +1,5 @@ | ||
const cluster = require('cluster'); | ||
const debug = require('debug')('log4js:clustering'); | ||
const LoggingEvent = require('./LoggingEvent'); | ||
const configuration = require('./configuration'); | ||
const cluster = require('cluster'); | ||
@@ -6,0 +6,0 @@ const listeners = []; |
@@ -25,4 +25,4 @@ 'use strict'; | ||
if (test) { | ||
throw new Error(`Problem with log4js configuration: (${util.inspect(config, { depth: 5 })})` + | ||
` - ${message}`); | ||
throw new Error(`Problem with log4js configuration: (${util.inspect(config, { depth: 5 })})` | ||
+ ` - ${message}`); | ||
} | ||
@@ -29,0 +29,0 @@ }); |
@@ -7,17 +7,16 @@ /* eslint-disable no-plusplus */ | ||
const DEFAULT_FORMAT = ':remote-addr - -' + | ||
' ":method :url HTTP/:http-version"' + | ||
' :status :content-length ":referrer"' + | ||
' ":user-agent"'; | ||
const DEFAULT_FORMAT = ':remote-addr - -' | ||
+ ' ":method :url HTTP/:http-version"' | ||
+ ' :status :content-length ":referrer"' | ||
+ ' ":user-agent"'; | ||
/** | ||
* 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 | ||
*/ | ||
/** | ||
* 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) { | ||
@@ -71,8 +70,8 @@ return req.originalUrl || req.url; | ||
token: ':remote-addr', | ||
replacement: req.headers['x-forwarded-for'] || | ||
req.ip || | ||
req._remoteAddress || | ||
(req.socket && | ||
(req.socket.remoteAddress || | ||
(req.socket.socket && req.socket.socket.remoteAddress) | ||
replacement: req.headers['x-forwarded-for'] | ||
|| req.ip | ||
|| req._remoteAddress | ||
|| (req.socket | ||
&& (req.socket.remoteAddress | ||
|| (req.socket.socket && req.socket.socket.remoteAddress) | ||
) | ||
@@ -84,5 +83,5 @@ ) | ||
token: ':content-length', | ||
replacement: res.getHeader('content-length') || | ||
(res.__headers && res.__headers['Content-Length']) || | ||
'-' | ||
replacement: res.getHeader('content-length') | ||
|| (res.__headers && res.__headers['Content-Length']) | ||
|| '-' | ||
}); | ||
@@ -89,0 +88,0 @@ defaultTokens.push({ |
@@ -46,8 +46,8 @@ 'use strict'; | ||
util.format( | ||
'[%s] [%s] %s - ' | ||
, dateFormat.asString(loggingEvent.startTime) | ||
, loggingEvent.level | ||
, loggingEvent.categoryName | ||
) | ||
, colour | ||
'[%s] [%s] %s - ', | ||
dateFormat.asString(loggingEvent.startTime), | ||
loggingEvent.level, | ||
loggingEvent.categoryName | ||
), | ||
colour | ||
); | ||
@@ -54,0 +54,0 @@ } |
@@ -68,2 +68,3 @@ 'use strict'; | ||
// eslint-disable-next-line no-use-before-define | ||
return log4js; | ||
@@ -70,0 +71,0 @@ } |
{ | ||
"name": "log4js", | ||
"version": "4.0.2", | ||
"version": "4.1.0", | ||
"description": "Port of Log4js to work with node.", | ||
@@ -32,4 +32,2 @@ "homepage": "https://log4js-node.github.io/log4js-node/", | ||
"clean": "find test -type f ! -name '*.json' ! -name '*.js' ! -name '.eslintrc' -delete && rm *.log", | ||
"prepush": "npm test && npm run typings", | ||
"commitmsg": "validate-commit-msg", | ||
"posttest": "npm run clean", | ||
@@ -47,6 +45,6 @@ "pretest": "eslint 'lib/**/*.js' 'test/**/*.js'", | ||
"date-format": "^2.0.0", | ||
"debug": "^3.1.0", | ||
"debug": "^4.1.1", | ||
"flatted": "^2.0.0", | ||
"rfdc": "^1.1.2", | ||
"streamroller": "^1.0.1" | ||
"streamroller": "^1.0.4" | ||
}, | ||
@@ -56,12 +54,12 @@ "devDependencies": { | ||
"codecov": "^3.0.2", | ||
"conventional-changelog": "^1.1.24", | ||
"conventional-changelog": "^3.0.6", | ||
"deep-freeze": "0.0.1", | ||
"eslint": "^4.19.1", | ||
"eslint-config-airbnb-base": "^12.1.0", | ||
"eslint": "^5.14.1", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-import-resolver-node": "^0.3.1", | ||
"eslint-plugin-import": "^2.11.0", | ||
"husky": "^0.14.3", | ||
"nyc": "^11.7.3", | ||
"tap": "^11.1.5", | ||
"typescript": "^2.8.3", | ||
"husky": "^1.3.1", | ||
"nyc": "^13.3.0", | ||
"tap": "^12.6.1", | ||
"typescript": "^3.3.3", | ||
"validate-commit-msg": "^2.14.0" | ||
@@ -101,3 +99,9 @@ }, | ||
] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"commit-msg": "validate-commit-msg", | ||
"pre-push": "npm test && npm run typings" | ||
} | ||
} | ||
} |
90008
32
2482
+ Addeddebug@4.4.0(transitive)
Updateddebug@^4.1.1
Updatedstreamroller@^1.0.4