Skip to content

Instantly share code, notes, and snippets.

@abrkn
Created October 23, 2012 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abrkn/3937698 to your computer and use it in GitHub Desktop.
Save abrkn/3937698 to your computer and use it in GitHub Desktop.
client (browser) side debug logging with socket.io
//not using console.log.apply because of compat *cough*ie*cough* issues)
this.socket.emit = _.wrap(this.socket.emit, function (fn, name, message) {
console.log('-->', name, _.toArray(arguments).slice(2));
return fn.apply(this, _.toArray(arguments).slice(1));
});
this.socket.$emit = _.wrap(this.socket.$emit, function (fn) {
console.log('<--', arguments[1], _.toArray(arguments).slice(2));
return fn.apply(this, _.toArray(arguments).slice(1));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment