mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
Improved code readability for shutdown() function
This commit is contained in:
parent
1e066b9bfa
commit
44bf7ce5bb
@ -104,9 +104,13 @@ function shutdown(cb) {
|
||||
(accum, next) => (next.shutdown ? accum + 1 : accum),
|
||||
0
|
||||
);
|
||||
if (shutdownFunctions === 0) {
|
||||
debug("No appenders with shutdown functions found.");
|
||||
return cb !== undefined && cb();
|
||||
}
|
||||
|
||||
let completed = 0;
|
||||
let error;
|
||||
|
||||
debug(`Found ${shutdownFunctions} appenders with shutdown functions.`);
|
||||
function complete(err) {
|
||||
error = error || err;
|
||||
@ -119,12 +123,6 @@ function shutdown(cb) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (shutdownFunctions === 0) {
|
||||
debug("No appenders with shutdown functions found.");
|
||||
return cb !== undefined && cb();
|
||||
}
|
||||
|
||||
appendersToCheck.filter(a => a.shutdown).forEach(a => a.shutdown(complete));
|
||||
|
||||
return null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user