[Groonga-commit] droonga/express-droonga at 3a4f6be [master] Output rich information for debugging with multiple droogna-engine hosts

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Oct 30 18:27:13 JST 2014


YUKI Hiroshi	2014-10-30 18:27:13 +0900 (Thu, 30 Oct 2014)

  New Revision: 3a4f6be1bd7822ee6221d4b6944cbea4fa9c4872
  https://github.com/droonga/express-droonga/commit/3a4f6be1bd7822ee6221d4b6944cbea4fa9c4872

  Message:
    Output rich information for debugging with multiple droogna-engine hosts

  Modified files:
    lib/droonga-protocol/connection.js

  Modified: lib/droonga-protocol/connection.js (+12 -6)
===================================================================
--- lib/droonga-protocol/connection.js    2014-10-30 17:55:48 +0900 (d99c826)
+++ lib/droonga-protocol/connection.js    2014-10-30 18:27:13 +0900 (bab676e)
@@ -61,6 +61,7 @@ Connection.prototype._init = function() {
   this.port = process.env.DROONGA_ENGINE_PORT ||
                           this._params.port ||
                             DEFAULT_FLUENT_PORT;
+  this.hostAndPort = this.hostName + ':' + this.port;
   this._initSender();
   this._initReceiver();
 };
@@ -118,8 +119,9 @@ Connection.prototype._initReceiver = function() {
   }).bind(this));
 
   var tag = this.tag + '.message';
-  this._logger.debug('Connection._initReceiver %d: %d %d:',
-                     this._id, receiver._id, this.receivePort, tag);
+  this._logger.debug('Connection._initReceiver %d (%s): %d %d:',
+                     this._id, this.hostAndPort,
+                     receiver._id, this.receivePort, tag);
   this._receiver = receiver;
   this._receiver.on(tag,
                     this._handleMessage.bind(this));
@@ -133,13 +135,15 @@ Connection.prototype._handleMessage = function(envelope) {
   var inReplyTo = envelope.inReplyTo;
   if (inReplyTo) {
     delete this._sendingMessages[inReplyTo];
-    this._logger.debug('Connection._handleMessage.reply %d:', this._id, envelope);
+    this._logger.debug('Connection._handleMessage.reply %d (%s):',
+                       this._id, this.hostAndPort, envelope);
     var errorCode = envelope.statusCode;
     if (!errorCode || isSuccess(errorCode))
       errorCode = null;
     this.emit('reply:' + inReplyTo, errorCode, envelope);
   } else {
-    this._logger.debug('Connection._handleMessage.message %d:', this._id, envelope);
+    this._logger.debug('Connection._handleMessage.message %d (%s):',
+                       this._id, this.hostAndPort, envelope);
     this.emit(envelope.type, envelope);
   }
 };
@@ -191,7 +195,8 @@ Connection.prototype.emitMessage = function(type, body, callback, options) {
   }
 
   var id = createId();
-  this._logger.debug('Connection.emitMessage %d:', this._id, id, type);
+  this._logger.debug('Connection.emitMessage %d (%s):',
+                     this._id, this.hostAndPort);
   var from = this.getRouteToSelf(options);
   var envelope = {
     id:         id,
@@ -207,7 +212,8 @@ Connection.prototype.emitMessage = function(type, body, callback, options) {
     var event = 'reply:' + id;
     var timeoutId;
     this.once(event, (function(errorCode, response) {
-      this._logger.debug('Connection.emitMessage.reply %d:', this._id, errorCode);
+      this._logger.debug('Connection.emitMessage.reply %d (%s):',
+                         this._id, this.hostAndPort, errorCode);
       clearTimeout(timeoutId);
       callback(errorCode, response);
     }).bind(this));
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index