Commit b2ec298e authored by Leo Iannacone's avatar Leo Iannacone

added debug helper function for socket

parent 4125f22b
...@@ -18,7 +18,7 @@ var debug = function() { ...@@ -18,7 +18,7 @@ var debug = function() {
var level = 1 var level = 1
if (arguments.length > 2) { if (arguments.length > 2) {
level = arguments[0] level = arguments[0]
arguments[0] = "debug (" + level + ") > " arguments[0] = "debug (" + level + ") >"
if (level <= config.preferences.debug) { if (level <= config.preferences.debug) {
if (console.debug) if (console.debug)
console.debug.apply(console, arguments) console.debug.apply(console, arguments)
...@@ -28,6 +28,21 @@ var debug = function() { ...@@ -28,6 +28,21 @@ var debug = function() {
} }
} }
/*
An helper debug function for socket events
usage: socket_debug("emit"|"received", event_name, data)
*/
var socket_debug = function() {
if (arguments.length != 3)
return
var level = 3;
if (arguments[0] == "received")
level = 4
debug(level, "socket >", arguments[0], "event:", arguments[1], "data:", arguments[2])
}
new Preferences() new Preferences()
new Page_Generic().init(socket) new Page_Generic().init(socket)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment