Class o2.Debugger


static class o2.Debugger

A static object for debugging purposes.

Usage example:

 // note: initalize Debugger only once,
 // possibly on window.load or dom content ready
 o2.Debugger.init(someDomNode, true);

 //then inside your code use this syntax.
 o2.Debugger.println('stuff to debug');
 
See also:
Defined in debugger.core

Function Summary
static assert (Expression pass, String message)

Checks the value of pass, and displays the message with a proper className.

The class name can be one of the Debugger.config.constants.className members.

Usage example:

 o2.Debugger.assert((1==true), '1 == true');
 
static error (String message)

Prints an error message to the output.

Usage example:

 o2.Debugger.error('A serious error occured');
 
static info (String message)

Prints an info message to the output.

Usage example:

 o2.Debugger.info('An info.');
 
static init (Object outputElement, Boolean shouldUseConsole)

Initializes the Debugger static class.

Either >outputElement>, or >shouldUseConsole, or both should be provided.

Usage example:

 o2.Debugger.init('divConsole', true);
 
static log (String message)

This is an alias to Debugger.println.

Simply logs a message.

Usage example:

 o2.Debugger.log('Hello world');
 
static println (String value, String className)

Prints the string representation of value to the next line.

Usage example:

 o2.Debugger.println('Hello world.');
 
static warn (String message)

Prints an warning message to the output.

Usage example:

 o2.Debugger.warn('caution!');
 

Function Details

function assert

static assert(Expression pass, String message)

Checks the value of pass, and displays the message with a proper className.

The class name can be one of the Debugger.config.constants.className members.

Usage example:

 o2.Debugger.assert((1==true), '1 == true');
 
Parameters:
pass - the expression to evaluate.
message - the message to display.
See also:

function error

static error(String message)

Prints an error message to the output.

Usage example:

 o2.Debugger.error('A serious error occured');
 
Parameters:
message - the error message to display.

function info

static info(String message)

Prints an info message to the output.

Usage example:

 o2.Debugger.info('An info.');
 
Parameters:
message - the info message to display.

function init

static init(Object outputElement, Boolean shouldUseConsole)

Initializes the Debugger static class.

Either >outputElement>, or >shouldUseConsole, or both should be provided.

Usage example:

 o2.Debugger.init('divConsole', true);
 
Parameters:
outputElement - Either the id of the element, or the element itself to append debug messages.
shouldUseConsole - should browser's built-in console be used, if available.

function log

static log(String message)

This is an alias to Debugger.println.

Simply logs a message.

Usage example:

 o2.Debugger.log('Hello world');
 
Parameters:
message - the message to log.
See also:

function println

static println(String value, String className)

Prints the string representation of value to the next line.

Usage example:

 o2.Debugger.println('Hello world.');
 
Parameters:
value - the value to print.
className - the CSS class name that is associated with the line.

function warn

static warn(String message)

Prints an warning message to the output.

Usage example:

 o2.Debugger.warn('caution!');
 
Parameters:
message - the warning message to display.