[Groonga-commit] groonga/express-droonga at 93ead43 [master] receiver: add debug logs

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Jul 21 16:34:05 JST 2013


Kouhei Sutou	2013-07-21 16:34:05 +0900 (Sun, 21 Jul 2013)

  New Revision: 93ead439c5388e54d28367b47b54538f0571695b
  https://github.com/groonga/express-droonga/commit/93ead439c5388e54d28367b47b54538f0571695b

  Message:
    receiver: add debug logs

  Modified files:
    lib/backend/receiver.js

  Modified: lib/backend/receiver.js (+7 -1)
===================================================================
--- lib/backend/receiver.js    2013-07-21 16:33:44 +0900 (5be126b)
+++ lib/backend/receiver.js    2013-07-21 16:34:05 +0900 (f829fb0)
@@ -1,3 +1,4 @@
+var debug = require('../debug');
 var net = require('net');
 var EventEmitter = require('events').EventEmitter;
 var msgpack = require('msgpack');
@@ -21,6 +22,7 @@ MsgPackReceiver.prototype._onConnect = function(socket) {
 };
 
 MsgPackReceiver.prototype._onMessageReceive = function(data) {
+  debug('MsgPackReceiver._onMessageReceive %d:', this._id);
   this.emit('receive', data);
 };
 
@@ -69,9 +71,13 @@ FluentReceiver.prototype = Object.create(MsgPackReceiver.prototype);
 FluentReceiver.prototype._onMessageReceive = function(packet) {
   MsgPackReceiver.prototype._onMessageReceive.call(this, packet);
   if (packet.length == 3) { // Message type
-    this.emit(packet[0], packet[2]);
+    var tag = packet[0];
+    var response = packet[2];
+    debug('FluentReceiver._onMessageReceive.message %d', this._id, tag);
+    this.emit(tag, response);
   }
   else { // Forward type
+    debug('FluentReceiver._onMessageReceive.forward %d', this._id, packet);
     packet[1].forEach(function(entry) {
       this.emit(packet[0], entry[1]);
     }, this);
-------------- next part --------------
HTML����������������������������...
Télécharger 



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