reduced complex function to smaller ones

This commit is contained in:
Gareth Jones 2013-06-04 08:37:36 +10:00
parent 0a2a6c0769
commit 94dbd22c71

View File

@ -111,21 +111,29 @@ function addAppender () {
}
args.forEach(function(category) {
if (!appenders[category]) {
appenders[category] = [];
}
appenders[category].push(appender);
addAppenderToCategory(appender, category);
if (category === ALL_CATEGORIES) {
addAppenderToAllLoggers(appender);
} else if (loggers[category]) {
loggers[category].addListener("log", appender);
}
});
}
function addAppenderToAllLoggers(appender) {
for (var logger in loggers) {
if (loggers.hasOwnProperty(logger)) {
loggers[logger].addListener("log", appender);
}
}
} else if (loggers[category]) {
loggers[category].addListener("log", appender);
}
});
function addAppenderToCategory(appender, category) {
if (!appenders[category]) {
appenders[category] = [];
}
appenders[category].push(appender);
}
function clearAppenders () {