projects
/
mkws-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7d05d3f
)
debug() will log with time stamp in milliseconds
author
Wolfram Schneider
<wosch@indexdata.dk>
Thu, 29 Aug 2013 13:16:59 +0000
(15:16 +0200)
committer
Wolfram Schneider
<wosch@indexdata.dk>
Thu, 29 Aug 2013 13:16:59 +0000
(15:16 +0200)
tools/htdocs/mkws.js
patch
|
blob
|
history
diff --git
a/tools/htdocs/mkws.js
b/tools/htdocs/mkws.js
index
144d2de
..
44a35a0
100644
(file)
--- a/
tools/htdocs/mkws.js
+++ b/
tools/htdocs/mkws.js
@@
-78,6
+78,11
@@
mkws.locale_lang = {
}
};
}
};
+// keep time state for debugging
+mkws.debug_time = {
+ "start": $.now(),
+ "last": $.now()
+};
mkws.debug = function (string) {
if (!mkws.debug)
return;
mkws.debug = function (string) {
if (!mkws.debug)
return;
@@
-86,13
+91,17
@@
mkws.debug = function (string) {
return;
}
return;
}
+ var now = $.now();
+ var timestamp = (now - mkws.debug_time.start)/1000 + " (+" + (now - mkws.debug_time.last)/1000 + ") "
+ mkws.debug_time.last = now;
+
// you need to disable use strict at the top of the file!!!
if (mkws.debug >= 3) {
// you need to disable use strict at the top of the file!!!
if (mkws.debug >= 3) {
- console.log(arguments.callee.caller);
+ console.log(timestamp + arguments.callee.caller);
} else if (mkws.debug >= 2) {
} else if (mkws.debug >= 2) {
- console.log(">>> called from function " + arguments.callee.caller.name + ' <<<');
+ console.log(timestamp + ">>> called from function " + arguments.callee.caller.name + ' <<<');
}
}
- console.log(string);
+ console.log(timestamp + string);
}
var debug = mkws.debug; // local alias
}
var debug = mkws.debug; // local alias