Created
October 23, 2012 08:48
-
-
Save abrkn/3937698 to your computer and use it in GitHub Desktop.
client (browser) side debug logging with socket.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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