From 713a78dc967574ffb4ee55acd6ee4a0b9a95d84e Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 4 Dec 2012 00:12:13 +0000 Subject: [PATCH] Add a new debug level that includes a stack trace --- phpgwapi/js/jsapi/egw_debug.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/phpgwapi/js/jsapi/egw_debug.js b/phpgwapi/js/jsapi/egw_debug.js index 57b4ffeb2f..1b85952e76 100644 --- a/phpgwapi/js/jsapi/egw_debug.js +++ b/phpgwapi/js/jsapi/egw_debug.js @@ -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") {