diff --git a/lib/sender.js b/lib/sender.js index 2934b2c..2a1a49e 100644 --- a/lib/sender.js +++ b/lib/sender.js @@ -53,7 +53,18 @@ function FluentSender(tag_prefix, options) { }; this.sharedKeySalt = crypto.randomBytes(16).toString('hex'); // helo, pingpong, established - this._status = null; + Object.defineProperties(this, { + '_status': { + get: function() { + return this.__status; + }, + set: function(newStatus) { + this.internalLogger.info({oldStatus: this.__status, newStatus: newStatus}); + this.__status = newStatus; + } + } + }); + this.__status = null; this._connecting = false; } @@ -451,6 +462,7 @@ FluentSender.prototype._setupErrorHandler = function _setupErrorHandler(callback this.internalLogger.info('Fluentd is reconnecting...'); this._connect(() => { this.internalLogger.info('Fluentd reconnection finished!!'); + this._handleEvent('reconnect'); }); }, this.reconnectInterval); callback && callback(timeoutId);