Logger.prototype.flush = function() { if (this.handlers.length === 0) { process.nextTick(this.handleFlushDone.bind(this)); } else { var all = new ewait.WaitForAll({ event: 'flushed' }); all.add(this.handlers); all.once('done', this.handleFlushDone.bind(this)); all.wait(); this.handlers.forEach(function(handler) { handler.flush(); }); } };
Container.prototype.flush = function(timeout) { var loggers = []; for (var name in this.loggers) { loggers.push(this.loggers[name]); } var all = new ewait.WaitForAll({ timeout: timeout || 5000, event: 'flushed' }); all.add(loggers); all.once('done', this.handleFlushDone.bind(this)); all.once('timeout', this.handleFlushTimeout.bind(this)); all.wait(); loggers.forEach(function(logger) { logger.flush(); }); };