egroupware/phpgwapi/js/jsapi/egw_debug.js
Andreas Stöckel d486e50a57 phpgwapi:
* Changed way of how "webserverUrl" gets set - any type of data can now be
	  injected into the egw object by creating an object with the data and an
	  entry "prefsOnly" set to true. This allows to ensure, that "webserverUrl"
	  is the first thing that is being set in the egw object (as needed when
	  including new JS/CSS files at runtime)

jsapi:
	* Fixed including JS/CSS files at runtime in other windows than the root
	  window
	* Added "ready" function/module, which provides an alternative to the
	  $j("ready") function. The ready module provides the functionality to
	  postpone calling the "ready" until certain events happened.
	* using jQuery calendar object instead of jscalendar in the calendar
	  function.
	* added "jquery" module which takes care of including all jQuery modules
	  in all windows
	* added possibility for modules to update constants using the "constant"
	  function.
	* added possibility for modules to access certain other modules using
	  the "module" function

etemplate:
	* Using new egw(window).ready function to build the template first if
	  loading has finished.
2012-03-09 15:32:29 +00:00

72 lines
1.7 KiB
JavaScript

/**
* EGroupware clientside API object
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package etemplate
* @subpackage api
* @link http://www.egroupware.org
* @author Andreas Stöckel (as AT stylite.de)
* @author Ralf Becker <RalfBecker@outdoor-training.de>
* @version $Id$
*/
"use strict";
/*egw:uses
egw_core;
*/
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;
/**
* The debug function can be used to send a debug message to the
* java script console. The first parameter specifies the debug
* level, all other parameters are passed to the corresponding
* console function.
*/
return {
debug: function(_level) {
if (typeof _wnd.console != "undefined")
{
// Get the passed parameters and remove the first entry
var args = [];
for (var i = 1; i < arguments.length; i++)
{
args.push(arguments[i]);
}
if (_level == "log" && DEBUGLEVEL >= 4 &&
typeof _wnd.console.log == "function")
{
_wnd.console.log.apply(_wnd.console, args);
}
if (_level == "info" && DEBUGLEVEL >= 3 &&
typeof _wnd.console.info == "function")
{
_wnd.console.info.apply(_wnd.console, args);
}
if (_level == "warn" && DEBUGLEVEL >= 2 &&
typeof _wnd.console.warn == "function")
{
_wnd.console.warn.apply(_wnd.console, args);
}
if (_level == "error" && DEBUGLEVEL >= 1 &&
typeof _wnd.console.error == "function")
{
_wnd.console.error.apply(_wnd.console, args);
}
}
}
}
});