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

Commit 49dad8b

Browse files
committed
Fixed Logger#child calls to actually create a child logger.
1 parent 8d134ab commit 49dad8b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/client.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var rewriteTopic = function(topic) {
1717
function Client(conn, server) {
1818
this.connection = conn;
1919
this.server = server;
20-
this.logger = server.logger.child({ client: this }, true);
20+
this.logger = server.logger;
2121
this.subscriptions = {};
2222

2323
this.nextId = 0;
@@ -109,7 +109,7 @@ Client.prototype.setUpTimer = function() {
109109
var timeout = this.keepalive * 1000 * 5 / 4;
110110
var that = this;
111111

112-
this.logger.info({ timeout: timeout }, "setting keepalive timeout");
112+
this.logger.debug({ timeout: timeout }, "setting keepalive timeout");
113113

114114
this.timer = setTimeout(function() {
115115
that.logger.info("keepalive timeout");
@@ -223,9 +223,10 @@ Client.prototype.unsubAndClose = function(cb) {
223223
* @api private
224224
*/
225225
Client.prototype.handleConnect = function(packet) {
226-
var that = this, logger = this.logger, client = this.connection;
226+
var that = this, logger, client = this.connection;
227227

228228
this.id = packet.clientId;
229+
this.logger = logger = that.logger.child({ client: this });
229230

230231
if (this.id.length > 23) {
231232
client.connack({

0 commit comments

Comments
 (0)