DuAEF.Debug

Tools for debugging

Members

static DebugLog :DebugLog|null

Set this attribute to a DebugLog you have created to automatically add some debug infos to the log (like catched errors).

static, readonly LogLevel :int

The log levels
Properties:
Name Type Description
VERBOSE int
DEBUG int
WARNING int
CRITICAL int
FATAL int
NO_DEBUG int

Methods

static error(error)

This methods shows an alert with an error thrown if DuAEF.debug is set to true, and logs it in DuAEF.Debug.DebugLog if it has been set.
Parameters:
Name Type Description
error Error | string An error thrown and catched

static inspect(obj, ownPropertiesopt) → {string}

Inspects a javascript object and outputs all of its attributes
Parameters:
Name Type Attributes Default Description
obj object The object to inspect.
ownProperties boolean <optional>
true Wether to inspect only the own properties of the object.
Returns:
string - The report.

static log(message, levelopt)

Logs a message to DuAEF.Debug.DebugLog if it has been set.
Parameters:
Name Type Attributes Default Description
message string The message to log
level DuAEF.Debug.LogLevel <optional>
DuAEF.Debug.LogLevel.DEBUG The level of the message

static safeRun(callback)

Runs a method/script safely, i.e. enclosed in a try...catch, and logs any error thrown.
arguments can be added after the first parameter, they will be passed to the callback.
The callback is enclosed in a function to make sure it does not create global variables.
Parameters:
Name Type Description
callback function | string The method to run, or a script as a string

static throwTypeError(variable, varName, varType, functionNameopt) → {string}

Alerts a nice TypeError description, if DuAEF.debug is true.
Note that it does not actually throws an error.
Parameters:
Name Type Attributes Description
variable any The failing argument
varName string The failing argument name
varType string The expected type
functionName string <optional>
The name or description of the function throwing the error.
Returns:
string - The (multiline) description for the error