forked from extern/egroupware
Expose debug level, and tie etemplate2 profiling to debug level 4 - Log
This commit is contained in:
parent
62966084ff
commit
56a595dc57
@ -355,10 +355,16 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback)
|
||||
// Register a handler for AJAX responses
|
||||
egw(currentapp, window).registerJSONPlugin(etemplate2_handle_assign, this, 'assign');
|
||||
|
||||
if(egw.debug_level() >= 3)
|
||||
{
|
||||
if(console.groupCollapsed)
|
||||
{
|
||||
egw.window.console.groupCollapsed("Loading %s into ", _name, '#'+this.DOMContainer.id);
|
||||
}
|
||||
}
|
||||
// Timing & profiling on debug level 'log' (4)
|
||||
if(egw.debug_level() >= 4)
|
||||
{
|
||||
if(console.time)
|
||||
{
|
||||
console.time(_name);
|
||||
@ -368,6 +374,7 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback)
|
||||
console.profile(_name);
|
||||
}
|
||||
var start_time = (new Date).getTime();
|
||||
}
|
||||
|
||||
// require necessary translations from server, if not already loaded
|
||||
if (!$j.isArray(_data.langRequire)) _data.langRequire = [];
|
||||
@ -434,7 +441,7 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback)
|
||||
|
||||
var _load = function() {
|
||||
egw.debug("log", "Loading template...");
|
||||
if(console.timeStamp)
|
||||
if(egw.debug_level() >= 4 && console.timeStamp)
|
||||
{
|
||||
console.timeStamp("Begin rendering template");
|
||||
}
|
||||
@ -462,7 +469,7 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback)
|
||||
// Insert the document fragment to the DOM Container
|
||||
this.DOMContainer.appendChild(frag);
|
||||
|
||||
if(console.groupEnd)
|
||||
if(egw.debug_level >= 3 && console.groupEnd)
|
||||
{
|
||||
egw.window.console.groupEnd();
|
||||
}
|
||||
@ -524,6 +531,8 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback)
|
||||
$j(this.DOMContainer).trigger('load', this);
|
||||
|
||||
// Profiling
|
||||
if(egw.debug_level() >= 4)
|
||||
{
|
||||
if(console.timeEnd)
|
||||
{
|
||||
console.timeEnd(_name);
|
||||
@ -537,6 +546,7 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback)
|
||||
if (!gen_time_div.length) gen_time_div = $j('.pageGenTime');
|
||||
gen_time_div.find('.et2RenderTime').remove();
|
||||
gen_time_div.append('<span class="et2RenderTime">'+egw.lang('eT2 rendering took %1s', (end_time-start_time)/1000)+'</span>');
|
||||
}
|
||||
},this));
|
||||
};
|
||||
|
||||
|
@ -315,6 +315,9 @@ egw.extend('debug', egw.MODULE_GLOBAL, function(_app, _wnd) {
|
||||
* console function.
|
||||
*/
|
||||
return {
|
||||
debug_level: function() {
|
||||
return DEBUGLEVEL;
|
||||
},
|
||||
debug: function(_level) {
|
||||
if (typeof _wnd.console != "undefined")
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user