Removed some console

Fixed issue 60
This commit is contained in:
Nicolas Dextraze
2019-02-18 09:11:51 -08:00
parent 2c272a19f5
commit 7db060af6e
7 changed files with 93 additions and 26 deletions

View File

@ -50,7 +50,7 @@ function EventStoreConnectionLogicHandler(esConnection, settings) {
EventEmitter.call(this);
this._esConnection = esConnection;
this._settings = settings;
this._queue = new SimpleQueuedHandler();
this._queue = new SimpleQueuedHandler(this._settings.log);
this._state = ConnectionState.Init;
this._connectingPhase = ConnectingPhase.Invalid;
this._endpointDiscoverer = null;
@ -722,4 +722,4 @@ EventStoreConnectionLogicHandler.prototype._logInfo = function(message){
this._settings.log.info("EventStoreConnection '%s': %s", this._esConnection.connectionName, message);
};
module.exports = EventStoreConnectionLogicHandler;
module.exports = EventStoreConnectionLogicHandler;

View File

@ -4,10 +4,11 @@ function typeName(t) {
throw new TypeError('type must be a function or object, not ' + typeof t);
}
function SimpleQueuedHandler() {
function SimpleQueuedHandler(log) {
this._handlers = {};
this._messages = [];
this._isProcessing = false;
this._log = log;
}
SimpleQueuedHandler.prototype.registerHandler = function(type, handler) {
@ -16,7 +17,7 @@ SimpleQueuedHandler.prototype.registerHandler = function(type, handler) {
try {
handler(msg);
} catch(e) {
console.log('ERROR: ', e.stack);
this._log.error('handle for', type, 'failed:', e.stack);
}
};
};
@ -41,4 +42,4 @@ SimpleQueuedHandler.prototype._processQueue = function() {
this._isProcessing = false;
};
module.exports = SimpleQueuedHandler;
module.exports = SimpleQueuedHandler;