class Debug (View source)

The Debug class holds all methods to help debugging while development.

The output of all the contained methods can be activated/deactivated with defining the AM_DEBUG_ENABLED constant. All logged information will be stored in $buffer as JS's console.log() items.

Properties

static private $buffer Log buffer.
static private $time Timestamp when script started.

Methods

static string
consoleLog()

Stop timer, calculate execution time, get user & server constants and return a console log item for every item in the buffer array.

static 
errorReporting()

Enable full error reporting, when debugging is enabled.

static array
getLog()

Return the buffer array.

static 
log(mixed $element, string $description = '')

Log any kind of variable and append it to the $buffer array.

static 
memory()

Provide info about memory usage.

static 
timerStart()

Start the timer on the first call to calculate the execution time when consoleLog() gets called.

static 
timerStop()

Stop the timer and log the execution time.

static 
uc()

Log all user constants for get_defined_constants().

Details

static string consoleLog()

Stop timer, calculate execution time, get user & server constants and return a console log item for every item in the buffer array.

Return Value

string The Javascript console log

static errorReporting()

Enable full error reporting, when debugging is enabled.

static array getLog()

Return the buffer array.

Return Value

array The log buffer array

static log(mixed $element, string $description = '')

Log any kind of variable and append it to the $buffer array.

Parameters

mixed $element (The actual content to log)
string $description (Basic info, class, method etc.)

static private memory()

Provide info about memory usage.

static private timerStart()

Start the timer on the first call to calculate the execution time when consoleLog() gets called.

static private timerStop()

Stop the timer and log the execution time.

static private uc()

Log all user constants for get_defined_constants().