Permalink
Browse files

Merge remote-tracking branch 'asiletto/master'

  • Loading branch information...
2 parents 4f81790 + c45f98f commit 9e5ab91bb853b657e41d7fa84857b67d2e1434d9 @christkv christkv committed Oct 8, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/mongodb/connection/connection.js
View
10 lib/mongodb/connection/connection.js
@@ -84,14 +84,19 @@ Connection.prototype.start = function() {
this.writeSteam.on("close", closeHandler(this));
// Start socket
this.connection.connect(this.socketOptions.port, this.socketOptions.host);
+ if(this.logger != null && this.logger.doDebug){
+ this.logger.debug("opened connection", this.socketOptions);
+ }
} else {
// Create new connection instance
if(!this.domainSocket) {
this.connection = net.createConnection(this.socketOptions.port, this.socketOptions.host);
} else {
this.connection = net.createConnection(this.socketOptions.host);
}
-
+ if(this.logger != null && this.logger.doDebug){
+ this.logger.debug("opened connection", this.socketOptions);
+ }
// Set options on the socket
this.connection.setTimeout(this.socketOptions.connectTimeoutMS != null ? this.socketOptions.connectTimeoutMS : this.socketOptions.timeout);
// Work around for 0.4.X
@@ -161,6 +166,9 @@ Connection.prototype.close = function() {
this.connection.on("error", function() {})
// destroy connection
this.connection.destroy();
+ if(this.logger != null && this.logger.doDebug){
+ this.logger.debug("closed connection", this.connection);
+ }
}
// Reset all handlers

0 comments on commit 9e5ab91

Please sign in to comment.