Skip to content
Snippets Groups Projects
Commit f5c18561 authored by mcmlxxix's avatar mcmlxxix
Browse files

disable logging of sent/received packets by default. (spammy if you are a *nix...

disable logging of sent/received packets by default. (spammy if you are a *nix user and cant control your bowels)
parent 2ff428f4
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,8 @@ Socket.prototype.max_recv = 131072;
Socket.prototype.recv_wait = 30;
/* last ping sent */
Socket.prototype.ping_sent = 0;
/* debug logging */
Socket.prototype.debug_logging = false;
/* socket prototype to automatically encode JSON data */
Socket.prototype.sendJSON = function(object) {
......@@ -20,7 +22,8 @@ Socket.prototype.sendJSON = function(object) {
this.nonblocking = false;
if(!this.send(data))
log(LOG_ERROR,"send failed ("+this.error+"): " + data);
log(LOG_DEBUG,"-->" + this.descriptor + ": " + data);
if(this.debug_logging)
log(LOG_DEBUG,"-->" + this.descriptor + ": " + data);
this.nonblocking=oldnb;
} catch(e) {
log(LOG_ERROR,e);
......@@ -31,7 +34,8 @@ Socket.prototype.sendJSON = function(object) {
Socket.prototype.recvJSON = function() {
var packet=this.recvline(this.max_recv,this.recv_wait);
if(packet != null) {
log(LOG_DEBUG,"<--" + this.descriptor + ": " + packet);
if(this.debug_logging)
log(LOG_DEBUG,"<--" + this.descriptor + ": " + packet);
try {
packet=JSON.parse(packet,this.reviver);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment