Class
caplin.core.log

StoreLogger

A caplin.core.log.Logger that stores log messages into internal arrays.

Constructor Summary

Attributes Name and Description
caplin.core.log.StoreLogger( level, Number maxRecords)

Constructs a StoreLogger.

Method Summary

Attributes Name and Description
Number addListener( listener)

void clear()

Clears all log records that have been stored in this StoreLogger.

String dump()

Provides all of the stored log information as a string.

Array getAllLogRecords()

Provides all of the stored log information.

caplin.core.log.LogRecord getLogRecord(Number n)

Retrieves a stored log record.

Number getSize()

void log(String level, Array logData)

Stores the time and all the log information internally.

void register(String classPattern)

Registers this logger as a caplin.core.log.LogStoreService with the ServiceRegistry and as a caplin.core.log.Logger with the EventHub (to receive log messages).

Number removeListener( id)

Methods inherited from class caplin.core.log.AbstractLogger:
logDataToString, setLevel
Methods from caplin.core.log.Logger:
debug, error, info, trace, warn

Constructor Detail

caplin.core.log.StoreLogger( level, Number maxRecords)

Constructs a StoreLogger.

Parameters
level the most detailed level at which to output log messages. Should be one of the levels defined statically on caplin.core.log.AbstractLogger. Will default to INFO level if not provided.
Number maxRecords an integer larger than 0 which is the maximum number of records to retain. If this parameter is not provided, then all records will be retained. This will create a memory leak if you do not periodically call clear.

Method Detail

Number addListener( listener)

Parameters
listener
Returns
{Number} The number of log messages stored.

void clear()

Clears all log records that have been stored in this StoreLogger.

String dump()

Provides all of the stored log information as a string.

Returns
a string containing all the logged records.

Array getAllLogRecords()

Provides all of the stored log information.

Returns
an array of caplin.core.log.LogRecords.

caplin.core.log.LogRecord getLogRecord(Number n)

Retrieves a stored log record.

Parameters
Number n the index of the log record to be retreived.
Returns
the nth oldest LogRecord (0 indexed) or undefined if n refers to a log record that hasn't been stored.

Number getSize()

Returns
{Number} The number of log messages stored.

void log(String level, Array logData)

Stores the time and all the log information internally.

Parameters
String level the name of the method that was called.
Array logData the log information.

void register(String classPattern)

Registers this logger as a caplin.core.log.LogStoreService with the ServiceRegistry and as a caplin.core.log.Logger with the EventHub (to receive log messages).

Parameters
String classPattern an optional pattern to restrict which messages the logger receives.

Number removeListener( id)

Parameters
id
Returns
{Number} The number of log messages stored.