Commit b9ee81a2 authored by Leo Iannacone's avatar Leo Iannacone

moved debug functions to new file

parent f62fa98d
/*
General indication for debugging use:
usage: debug(level, args)
args: can be everything
level: 1 - user interaction
2 - automatic changes
3 - socket emit data
4 - socket received data
*/
var debug = function() {
if (arguments.length == 0) {
return
}
var level = 1
if (arguments.length > 2) {
level = arguments[0]
arguments[0] = "debug (" + level + ") >"
if (level <= config.preferences.debug) {
if (console.debug)
console.debug.apply(console, arguments)
else
console.log.apply(console, arguments)
}
}
}
/*
An helper debug function for socket events
usage: debug_socket("emit"|"received", event_name, data)
*/
var debug_socket = 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])
}
\ No newline at end of file
var socket = io.connect('//' + config.hostname );
/*
General indication for debugging use:
usage: debug(level, args)
args: can be everything
level: 1 - user interaction
2 - automatic changes
3 - socket emit data
4 - socket received data
*/
var debug = function() {
if (arguments.length == 0) {
return
}
var level = 1
if (arguments.length > 2) {
level = arguments[0]
arguments[0] = "debug (" + level + ") >"
if (level <= config.preferences.debug) {
if (console.debug)
console.debug.apply(console, arguments)
else
console.log.apply(console, arguments)
}
}
}
/*
An helper debug function for socket events
usage: debug_socket("emit"|"received", event_name, data)
*/
var debug_socket = 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()
......
......@@ -69,6 +69,7 @@
</script>
<script src='/javascripts/debug.js'></script>
<script src='/javascripts/utils.js'></script>
<script src='/javascripts/preferences.js'></script>
<script src='/javascripts/page_generic.js'></script>
......
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