Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
145d5f91e3 | ||
|
a669f7c2f4 |
@ -85,7 +85,9 @@ function configure(config, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function shutdown(cb) {
|
function shutdown(cb) {
|
||||||
async.each(openFiles, function(file, done) {
|
var filesToClose = openFiles;
|
||||||
|
openFiles = [];
|
||||||
|
async.each(filesToClose, function(file, done) {
|
||||||
if (!file.write(eol, "utf-8")) {
|
if (!file.write(eol, "utf-8")) {
|
||||||
file.once('drain', function() {
|
file.once('drain', function() {
|
||||||
file.end(done);
|
file.end(done);
|
||||||
|
@ -219,6 +219,11 @@ function clearAppenders () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearAndShutdownAppenders(cb) {
|
||||||
|
clearAppenders();
|
||||||
|
shutdownAppenders(cb);
|
||||||
|
}
|
||||||
|
|
||||||
function configureAppenders(appenderList, options) {
|
function configureAppenders(appenderList, options) {
|
||||||
clearAppenders();
|
clearAppenders();
|
||||||
if (appenderList) {
|
if (appenderList) {
|
||||||
@ -428,7 +433,10 @@ function shutdown(cb) {
|
|||||||
// First, disable all writing to appenders. This prevents appenders from
|
// First, disable all writing to appenders. This prevents appenders from
|
||||||
// not being able to be drained because of run-away log writes.
|
// not being able to be drained because of run-away log writes.
|
||||||
loggerModule.disableAllLogWrites();
|
loggerModule.disableAllLogWrites();
|
||||||
|
shutdownAppenders(cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
function shutdownAppenders(cb) {
|
||||||
// Next, get all the shutdown functions for appenders as an array.
|
// Next, get all the shutdown functions for appenders as an array.
|
||||||
var shutdownFunctions = Object.keys(appenderShutdowns).reduce(
|
var shutdownFunctions = Object.keys(appenderShutdowns).reduce(
|
||||||
function(accum, category) {
|
function(accum, category) {
|
||||||
@ -454,6 +462,7 @@ module.exports = {
|
|||||||
addAppender: addAppender,
|
addAppender: addAppender,
|
||||||
loadAppender: loadAppender,
|
loadAppender: loadAppender,
|
||||||
clearAppenders: clearAppenders,
|
clearAppenders: clearAppenders,
|
||||||
|
clearAndShutdownAppenders: clearAndShutdownAppenders,
|
||||||
configure: configure,
|
configure: configure,
|
||||||
shutdown: shutdown,
|
shutdown: shutdown,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user