@qooxdoo/framework
Version:
The JS Framework for Coders
105 lines (85 loc) • 2.75 kB
JavaScript
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
MIT: https://opensource.org/licenses/MIT
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (martinwittemann)
************************************************************************ */
/**
* This mixin offers the basic logging features offered by {@link qx.log.Logger}.
*/
qx.Mixin.define("qx.core.MLogging",
{
members :
{
/** @type {Class} Pointer to the regular logger class */
__Logger : qx.log.Logger,
/**
* Logs a debug message.
*
* @param varargs {var} The item(s) to log. Any number of arguments is
* supported. If an argument is not a string, the object dump will be
* logged.
*/
debug : function(varargs) {
this.__logMessage("debug", arguments);
},
/**
* Logs an info message.
*
* @param varargs {var} The item(s) to log. Any number of arguments is
* supported. If an argument is not a string, the object dump will be
* logged.
*/
info : function(varargs) {
this.__logMessage("info", arguments);
},
/**
* Logs a warning message.
*
* @param varargs {var} The item(s) to log. Any number of arguments is
* supported. If an argument is not a string, the object dump will be
* logged.
*/
warn : function(varargs) {
this.__logMessage("warn", arguments);
},
/**
* Logs an error message.
*
* @param varargs {var} The item(s) to log. Any number of arguments is
* supported. If an argument is not a string, the object dump will be
* logged.
*/
error : function(varargs) {
this.__logMessage("error", arguments);
},
/**
* Logs an error message with the current stack trace
*
* @param varargs {var} The item(s) to log. Any number of arguments is
* supported. If an argument is not a string, the object dump will be
* logged.
*/
trace : function(varargs) {
this.__logMessage("trace", arguments);
},
/**
* Helper that calls the appropriate logger function with the current object
* and any number of items.
*
* @param level {String} The log level of the message
* @param varargs {arguments} Arguments list to be logged
*/
__logMessage : function(level, varargs)
{
var argumentsArray = qx.lang.Array.fromArguments(varargs);
argumentsArray.unshift(this);
this.__Logger[level].apply(this.__Logger, argumentsArray);
}
}
});