Skip to content

Commit

Permalink
Pushing debug level logging to trace. Debug log now only shows stanza…
Browse files Browse the repository at this point in the history
…s exchanged.
  • Loading branch information
satyamshekhar committed Feb 18, 2012
1 parent 05e5832 commit 31270bb
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 77 deletions.
14 changes: 7 additions & 7 deletions src/bosh.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ exports.createServer = function (options) {

// Check if this is a session start packet.
if (helper.is_session_creation_packet(node)) {
log.debug("Session Creation");
log.trace("Session Creation");
session = session_store.add_session(node, res);
stream = stream_store.add_stream(session, node);

Expand All @@ -153,21 +153,21 @@ exports.createServer = function (options) {
} else {
session = session_store.get_session(node);
if (!session) { //No (valid) session ID in BOSH request. Not phare enuph.
log.debug("%s Invalid Session", node.attrs.sid || "No_Session_ID");
log.trace("%s Invalid Session", node.attrs.sid || "No_Session_ID");
session_store.send_invalid_session_terminate_response(res, node);
return;
}
try {
// This is enclosed in a try/catch block since invalid requests
// at this point MAY not have these attributes
log.debug("%s %s req.rid: %s, session.rid: %s", session.sid,
log.trace("%s %s req.rid: %s, session.rid: %s", session.sid,
node.attrs.stream || "NO_Stream", node.attrs.rid,
session.rid);
} catch (ex) { }

// Check the validity of the packet and the BOSH session
if (!session.is_valid_packet(node)) {
log.debug("%s Invalid Packet", session.sid);
log.trace("%s Invalid Packet", session.sid);
session.send_invalid_packet_terminate_response(res, node);
return;
}
Expand Down Expand Up @@ -237,7 +237,7 @@ exports.createServer = function (options) {
// When the Connector is able to add the stream, we too do the same and
// respond to the client accordingly.
function _on_stream_added(stream) {
log.debug("%s %s stream-added", stream.state.sid, stream.name);
log.trace("%s %s stream-added", stream.state.sid, stream.name);
// Send only if this is the 2nd (or more) stream on this BOSH session.
// This should work all the time. If anyone finds a case where it will
// NOT work, please do let me know.
Expand All @@ -250,7 +250,7 @@ exports.createServer = function (options) {
// When a response is received from the connector, try to send it out to the
// real client if possible.
function _on_repsponse(connector_response, stream) {
log.debug("%s %s response: %s", stream.state.sid, stream.name, connector_response);
log.trace("%s %s response: %s", stream.state.sid, stream.name, connector_response);
var session = stream.session;
session.enqueue_stanza(connector_response, stream);
}
Expand Down Expand Up @@ -288,4 +288,4 @@ exports.createServer = function (options) {
bep.set_session_data(session_store);
bep.set_stream_data(stream_store);
return bep;
};
};
4 changes: 2 additions & 2 deletions src/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function route_parse(route) {
* TODO: Move this out of bosh.js and into lookup_service.js
*/
var m = route.match(/^(\S+):(\S+):([0-9]+)$/) || [ ];
log.debug("route_parse: %s", m);
log.trace("route_parse: %s", m);
if (m && m.length === 4) {
return {protocol: m[1], host: m[2], port: toNumber(m[3])};
} else {
Expand Down Expand Up @@ -210,4 +210,4 @@ exports.is_stream_restart_packet = is_stream_restart_packet;
exports.is_stream_add_request = is_stream_add_request;
exports.is_stream_terminate_request = is_stream_terminate_request;
exports.is_session_creation_packet = is_session_creation_packet;
exports.sanitize_request_node = sanitize_request_node;
exports.sanitize_request_node = sanitize_request_node;
5 changes: 3 additions & 2 deletions src/http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function HTTPServer(port, host, stat_func, bosh_request_handler, http_error_hand
log.warn("Timed out - destroying connection from '%s'", req.socket.remoteAddress);
req.destroy();
} else {
log.debug("RECD: %s", data);
bosh_request_handler(res, data);
clearTimeout(end_timeout);
}
Expand Down Expand Up @@ -146,7 +147,7 @@ function HTTPServer(port, host, stat_func, bosh_request_handler, http_error_hand
}

function handle_unhandled_request(req, res, u) {
log.debug("Invalid request, method: %s path: %s", req.method, u.pathname);
log.trace("Invalid request, method: %s path: %s", req.method, u.pathname);
var _headers = { };
dutil.copy(_headers, bosh_options.HTTP_POST_RESPONSE_HEADERS);
_headers['Content-Type'] = 'text/plain; charset=utf-8';
Expand Down Expand Up @@ -181,4 +182,4 @@ function HTTPServer(port, host, stat_func, bosh_request_handler, http_error_hand
this.http_server = server;
}

exports.HTTPServer = HTTPServer;
exports.HTTPServer = HTTPServer;
6 changes: 3 additions & 3 deletions src/lookup-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ dutil.copy(XMPPLookupService.prototype, {
var _add_all_listeners = SRV.removeListeners(socket);

function _on_socket_connect(e) {
log.debug('Connection to %s succeeded',self._domain_name);
log.trace('Connection to %s succeeded',self._domain_name);
_add_all_listeners(true);

// Re-trigger the connect event.
Expand All @@ -86,7 +86,7 @@ dutil.copy(XMPPLookupService.prototype, {
function try_connect_route() {
// First just connect to the server if this._route is defined.
if (self._route) {
log.debug('try_connect_route - %s:%s', self._route.host, self._route.port);
log.trace('try_connect_route - %s:%s', self._route.host, self._route.port);
// socket.setTimeout(10000);
socket.connect(self._route.port, self._route.host);
}
Expand All @@ -97,7 +97,7 @@ dutil.copy(XMPPLookupService.prototype, {
}

function try_connect_SRV_lookup() {
log.debug('try_connect_SRV_lookup - %s',self._domain_name);
log.trace('try_connect_SRV_lookup - %s',self._domain_name);

// Then try a normal SRV lookup.

Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ exports.start_bosh = function(options) {
// Example:
bosh_server.on("response-acknowledged", function(wrapped_response, session) {
// What to do with this response??
log.debug("%s Response Acknowledged: %s", session.sid, wrapped_response.rid);
log.trace("%s Response Acknowledged: %s", session.sid, wrapped_response.rid);
});

return bosh_server;
Expand Down
Loading

0 comments on commit 31270bb

Please sign in to comment.