Add a new debug level that includes a stack trace

This commit is contained in:
Nathan Gray 2012-12-04 00:12:13 +00:00
parent bff2bdc6d6
commit 713a78dc96

View File

@ -22,7 +22,7 @@ egw.extend('debug', egw.MODULE_GLOBAL, function(_app, _wnd) {
* DEBUGLEVEL specifies which messages are printed to the console.
* Decrease the value of EGW_DEBUGLEVEL to get less messages.
*/
var DEBUGLEVEL = 4;
var DEBUGLEVEL = 5;
/**
* The debug function can be used to send a debug message to the
@ -41,6 +41,13 @@ egw.extend('debug', egw.MODULE_GLOBAL, function(_app, _wnd) {
args.push(arguments[i]);
}
// Add in a trace
if (DEBUGLEVEL >= 5 && (_level == "warn" || _level == "error") && typeof (new Error).stack != "undefined")
{
var stack = (new Error).stack;
args.push(stack);
}
if (_level == "log" && DEBUGLEVEL >= 4 &&
typeof _wnd.console.log == "function")
{