feature: allow passing cwd as an option
This commit is contained in:
parent
2ab6f5fa24
commit
b4ca201a91
@ -324,14 +324,20 @@ function initReloadConfiguration(filename, options) {
|
|||||||
|
|
||||||
function configure (configurationFileOrObject, options) {
|
function configure (configurationFileOrObject, options) {
|
||||||
var config = configurationFileOrObject;
|
var config = configurationFileOrObject;
|
||||||
|
options = options || {};
|
||||||
|
if (options.hasOwnProperty('cwd')) {
|
||||||
|
config.appenders.forEach(function(appender) {
|
||||||
|
if (appender.hasOwnProperty('filename')) {
|
||||||
|
appender.filename = options.cwd + '/' + appender.filename;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
if (config === undefined || config === null || typeof(config) === 'string') {
|
if (config === undefined || config === null || typeof(config) === 'string') {
|
||||||
options = options || { };
|
|
||||||
if (options.reloadSecs) {
|
if (options.reloadSecs) {
|
||||||
initReloadConfiguration(config, options);
|
initReloadConfiguration(config, options);
|
||||||
}
|
}
|
||||||
configureOnceOff(loadConfigurationFile(config));
|
configureOnceOff(loadConfigurationFile(config));
|
||||||
} else {
|
} else {
|
||||||
options = options || {};
|
|
||||||
if (options.reloadSecs) {
|
if (options.reloadSecs) {
|
||||||
getLogger('log4js').warn('Ignoring configuration reload parameter for "object" configuration.');
|
getLogger('log4js').warn('Ignoring configuration reload parameter for "object" configuration.');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user