Comparing version 6.1.1 to 6.1.2
# log4js-node changelog | ||
## 6.1.2 | ||
- [Handle out-of-order appender loading](https://github.com/log4js-node/log4js-node/pull/986) - thanks [@mvastola](https://github.com/mvastola) | ||
## 6.1.1 | ||
@@ -4,0 +8,0 @@ |
@@ -43,2 +43,18 @@ const path = require('path'); | ||
const appendersLoading = new Set(); | ||
const getAppender = (name, config) => { | ||
if (appenders.has(name)) return appenders.get(name); | ||
if (!config.appenders[name]) return false; | ||
if (appendersLoading.has(name)) throw new Error(`Dependency loop detected for appender ${name}.`); | ||
appendersLoading.add(name); | ||
debug(`Creating appender ${name}`); | ||
// eslint-disable-next-line no-use-before-define | ||
const appender = createAppender(name, config); | ||
appendersLoading.delete(name); | ||
appenders.set(name, appender); | ||
return appender; | ||
}; | ||
const createAppender = (name, config) => { | ||
@@ -67,3 +83,3 @@ const appenderConfig = config.appenders[name]; | ||
layouts, | ||
appender => appenders.get(appender), | ||
appender => getAppender(appender, config), | ||
levels | ||
@@ -76,6 +92,5 @@ ); | ||
appenders.clear(); | ||
appendersLoading.clear(); | ||
Object.keys(config.appenders).forEach((name) => { | ||
debug(`Creating appender ${name}`); | ||
appenders.set(name, createAppender(name, config)); | ||
getAppender(name, config); | ||
}); | ||
@@ -82,0 +97,0 @@ }; |
{ | ||
"name": "log4js", | ||
"version": "6.1.1", | ||
"version": "6.1.2", | ||
"description": "Port of Log4js to work with node.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://log4js-node.github.io/log4js-node/", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103105
2704