reduced complex function to smaller ones
This commit is contained in:
parent
0a2a6c0769
commit
94dbd22c71
@ -111,23 +111,31 @@ function addAppender () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
args.forEach(function(category) {
|
args.forEach(function(category) {
|
||||||
if (!appenders[category]) {
|
addAppenderToCategory(appender, category);
|
||||||
appenders[category] = [];
|
|
||||||
}
|
|
||||||
appenders[category].push(appender);
|
|
||||||
|
|
||||||
if (category === ALL_CATEGORIES) {
|
if (category === ALL_CATEGORIES) {
|
||||||
for (var logger in loggers) {
|
addAppenderToAllLoggers(appender);
|
||||||
if (loggers.hasOwnProperty(logger)) {
|
|
||||||
loggers[logger].addListener("log", appender);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (loggers[category]) {
|
} else if (loggers[category]) {
|
||||||
loggers[category].addListener("log", appender);
|
loggers[category].addListener("log", appender);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addAppenderToAllLoggers(appender) {
|
||||||
|
for (var logger in loggers) {
|
||||||
|
if (loggers.hasOwnProperty(logger)) {
|
||||||
|
loggers[logger].addListener("log", appender);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addAppenderToCategory(appender, category) {
|
||||||
|
if (!appenders[category]) {
|
||||||
|
appenders[category] = [];
|
||||||
|
}
|
||||||
|
appenders[category].push(appender);
|
||||||
|
}
|
||||||
|
|
||||||
function clearAppenders () {
|
function clearAppenders () {
|
||||||
appenders = {};
|
appenders = {};
|
||||||
for (var logger in loggers) {
|
for (var logger in loggers) {
|
||||||
|
Loading…
Reference in New Issue
Block a user