[Groonga-commit] droonga/express-droonga at 5d0ddf0 [master] Shorten

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Nov 5 15:25:15 JST 2014


YUKI Hiroshi	2014-11-05 15:25:15 +0900 (Wed, 05 Nov 2014)

  New Revision: 5d0ddf00a496e515ecb5a3c1cfc49dcf918aa0d2
  https://github.com/droonga/express-droonga/commit/5d0ddf00a496e515ecb5a3c1cfc49dcf918aa0d2

  Message:
    Shorten

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

  Modified: lib/droonga-protocol/connection-pool.js (+9 -10)
===================================================================
--- lib/droonga-protocol/connection-pool.js    2014-11-05 13:20:43 +0900 (bf0069e)
+++ lib/droonga-protocol/connection-pool.js    2014-11-05 15:25:15 +0900 (52cb727)
@@ -21,8 +21,7 @@ var SerfAgent = require('../serf/agent');
 function ConnectionPool(params) {
   this._params = params || {};
 
-  if (!this._params.logger)
-    this._params.logger = new ConsoleLogger();
+  this._logger = this._params.logger || new ConsoleLogger();
 
   this._hostNames = [];
   this._connections = {};
@@ -90,7 +89,7 @@ ConnectionPool.prototype = {
       port:            this._params.port,
       receiveHostName: this._params.receiveHostName,
       receivePort:     this._params.receivePort,
-      logger:          this._params.logger
+      logger:          this._logger
     });
   },
 
@@ -133,10 +132,10 @@ ConnectionPool.prototype = {
                        .then(this._handleFetchedCatalog.bind(this));
   },
   _handleFetchedCatalog: function(result) {
-    this._params.logger.debug('ConnectionPool: fetchCatalog: fetched result');
-    this._params.logger.debug(result);
+    this._logger.debug('ConnectionPool: fetchCatalog: fetched result');
+    this._logger.debug(result);
     if (result.errorCode) {
-      this._params.logger.error(new Error('ConnectionPool: failed to fetch catalog'));
+      this._logger.error(new Error('ConnectionPool: failed to fetch catalog'));
       return;
     }
     var catalog = result.response.body;
@@ -170,13 +169,13 @@ ConnectionPool.prototype = {
     return this.getHostNamesFromCluster()
                  .then((function(hostNames) {
                    this.hostNames = hostNames;
-                   this._params.logger.info('List of droonga-engine hosts is successfully initialized from the cluster.');
-                   this._params.logger.info(hostNames);
+                   this._logger.info('List of droonga-engine hosts is successfully initialized from the cluster.');
+                   this._logger.info(hostNames);
                    return hostNames;
                  }).bind(this))
                  .catch(function(error) {
-                   this._params.logger.error('Failed to initialize the list of droonga-engine hosts from the cluster.');
-                   this._params.logger.error(error);
+                   this._logger.error('Failed to initialize the list of droonga-engine hosts from the cluster.');
+                   this._logger.error(error);
                  });
   },
 
-------------- next part --------------
HTML����������������������������...
下載 



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