configure now takes a filename or object
This commit is contained in:
@@ -591,16 +591,19 @@ module.exports = function (fileSystem, standardOutput, configPaths) {
|
||||
}
|
||||
}
|
||||
|
||||
function configure (configurationFile) {
|
||||
if (configurationFile) {
|
||||
try {
|
||||
var config = JSON.parse(fs.readFileSync(configurationFile, "utf8"));
|
||||
configureAppenders(config.appenders, fileAppender, consoleAppender);
|
||||
configureLevels(config.levels);
|
||||
} catch (e) {
|
||||
throw new Error("Problem reading log4js config file " + configurationFile + ". Error was \"" + e.message + "\" ("+e.stack+")");
|
||||
}
|
||||
function configure (configurationFileOrObject) {
|
||||
var config = configurationFileOrObject;
|
||||
if (typeof(config) === "string") {
|
||||
config = JSON.parse(fs.readFileSync(config, "utf8"));
|
||||
}
|
||||
if (config) {
|
||||
try {
|
||||
configureAppenders(config.appenders, fileAppender, consoleAppender);
|
||||
configureLevels(config.levels);
|
||||
} catch (e) {
|
||||
throw new Error("Problem reading log4js config " + sys.inspect(config) + ". Error was \"" + e.message + "\" ("+e.stack+")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function findConfiguration() {
|
||||
|
||||
Reference in New Issue
Block a user