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

consoleName: 'Console'

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

TRACE

TRACE: false

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

DEBUG

DEBUG: true

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

WARN

WARN: true

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

buffer

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.

consoleName: 'Console'
Specifies the name of the console window.
TRACE: false
Specified if the output for enter and leave should be visible in the console.
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: true
Specifies if the output for debug should be visible in the console.
debug: function()
Adds all arguments to the console if DEBUG is enabled.
WARN: true
Specifies if the output for warn should be visible in the console.
warn: function()
Adds all arguments to the console if WARN is enabled.
buffer: ''
Buffer for pre-initialized content.
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.
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