mxLog

A singleton class that implements a simple console.

Summary
mxLogA singleton class that implements a simple console.
Variables
consoleNameSpecifies the name of the console window.
TRACESpecified if the output for enter and leave should be visible in the console.
DEBUGSpecifies if the output for debug should be visible in the console.
WARNSpecifies if the output for warn should be visible in the console.
bufferBuffer for pre-initialized content.
Functions
initInitializes the DOM node for the console.
infoWrites the current navigator information to the console.
addButtonAdds a button to the console using the given label and function.
isVisibleReturns true if the console is visible.
showShows the console.
setVisibleShows or hides the console.
enterWrites the specified string to the console if TRACE is true and returns the current time in milliseconds.
leaveWrites the specified string to the console if TRACE is true and computes the difference between the current time and t0 in milliseconds.
debugAdds all arguments to the console if DEBUG is enabled.
warnAdds all arguments to the console if WARN is enabled.
writeAdds the specified strings to the console.
writelnAdds the specified strings to the console, appending a linefeed at the end of each string.

Variables

consoleName

Specifies the name of the console window.  Default is ‘Console’.

TRACE

Specified if the output for enter and leave should be visible in the console.  Default is false.

DEBUG

Specifies if the output for debug should be visible in the console.  Default is true.

WARN

Specifies if the output for warn should be visible in the console.  Default is true.

buffer

Buffer for pre-initialized content.

Functions

init

init: function()

Initializes the DOM node for the console.  This requires document.body to point to a non-null value.  This is called from within setVisible if the log has not yet been initialized.

info

info: function()

Writes the current navigator information to the console.

addButton

addButton: function(lab,
funct)

Adds a button to the console using the given label and function.

isVisible

isVisible: function()

Returns true if the console is visible.

show

show: function()

Shows the console.

setVisible

setVisible: function(visible)

Shows or hides the console.

enter

enter: function(string)

Writes the specified string to the console if TRACE is true and returns the current time in milliseconds.

Example

mxLog.show();
var t0 = mxLog.enter('Hello');
// Do something
mxLog.leave('World!', t0);

leave

leave: function(string,
t0)

Writes the specified string to the console if TRACE is true and computes the difference between the current time and t0 in milliseconds.  See enter for an example.

debug

debug: function()

Adds all arguments to the console if DEBUG is enabled.

Example

mxLog.show();
mxLog.debug('Hello, World!');

warn

warn: function()

Adds all arguments to the console if WARN is enabled.

Example

mxLog.show();
mxLog.warn('Hello, World!');

write

write: function()

Adds the specified strings to the console.

writeln

writeln: function()

Adds the specified strings to the console, appending a linefeed at the end of each string.

enter: function(string)
Writes the specified string to the console if TRACE is true and returns the current time in milliseconds.
leave: function(string,
t0)
Writes the specified string to the console if TRACE is true and computes the difference between the current time and t0 in milliseconds.
debug: function()
Adds all arguments to the console if DEBUG is enabled.
warn: function()
Adds all arguments to the console if WARN is enabled.
init: function()
Initializes the DOM node for the console.
info: function()
Writes the current navigator information to the console.
addButton: function(lab,
funct)
Adds a button to the console using the given label and function.
isVisible: function()
Returns true if the console is visible.
show: function()
Shows the console.
setVisible: function(visible)
Shows or hides the console.
Specified if the output for enter and leave should be visible in the console.
Specifies if the output for debug should be visible in the console.
Specifies if the output for warn should be visible in the console.
write: function()
Adds the specified strings to the console.
writeln: function()
Adds the specified strings to the console, appending a linefeed at the end of each string.
Close