Skip to content
This repository was archived by the owner on Feb 11, 2020. It is now read-only.

Commit 154dfb3

Browse files
committed
Improved logging.
1 parent 2c5efdd commit 154dfb3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/client.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function Client(conn, server) {
2929
* @api private
3030
*/
3131
Client.prototype._setup = function() {
32-
var that = this, logger = this.logger, client = that.connection;
32+
var that = this, client = that.connection;
3333

3434
this._buildForward();
3535

@@ -42,7 +42,7 @@ Client.prototype._setup = function() {
4242
});
4343

4444
client.on("pingreq", function() {
45-
logger.debug("pingreq");
45+
that.logger.debug("pingreq");
4646
that.setUpTimer();
4747
that.connection.pingresp();
4848
});
@@ -59,10 +59,10 @@ Client.prototype._setup = function() {
5959
});
6060

6161
client.on("unsubscribe", function(packet) {
62-
logger.info({ packet: packet }, "unsubscribe received");
62+
that.logger.info({ packet: packet }, "unsubscribe received");
6363
async.parallel(packet.unsubscriptions.map(that.unsubscribeMapTo.bind(that)), function(err) {
6464
if (err) {
65-
logger.warn(err);
65+
that.logger.warn(err);
6666
that.unsubAndClose();
6767
return;
6868
}
@@ -73,17 +73,17 @@ Client.prototype._setup = function() {
7373
});
7474

7575
client.on("disconnect", function() {
76-
logger.debug("disconnect requested");
76+
that.logger.debug("disconnect requested");
7777
that.unsubAndClose();
7878
});
7979

8080
client.on("error", function(err) {
81-
logger.warn(err);
81+
that.logger.warn(err);
8282
that.unsubAndClose();
8383
});
8484

8585
client.on("close", function() {
86-
logger.info("disconnected");
86+
that.logger.info("disconnected");
8787
that._closed = true;
8888
that.onClose();
8989
});

0 commit comments

Comments
 (0)