Caplin Trader 4.8.0

Interface: module:caplin/core/log/LogStoreService

module:caplin/core/log/LogStoreService

This represents an interface, and should not normally be constructed. A service that stores log messages and can be used to retrieve them. A LogStoreService should be registered with:
caplin.core.ServiceRegistry.registerService("caplin.log-store-service", myLogStoreService);
and acquired with
var myLogStoreService = require("service!caplin.log-store-service");

Methods

addListener(callback) → {Number}

Adds a listener the that will be notified if the stored contents changes.
Parameters:
Name Type Description
callback function The function that will be called on any changes.
Returns:
An id for the listener that can be used to remove it (see module:caplin/core/log/LogStoreService#removeListener).
Type
Number

clear()

Clears all stored log records.

getAllLogRecords() → {Array}

Retrieves all stored log records.
Returns:
an array of module:caplin/core/log/LogRecords. Will not be null.
Type
Array

getLogRecord(n) → {module:caplin/core/log/LogRecord}

Retrieves a stored log record.
Parameters:
Name Type Description
n Number the index of the log record to be retrieved.
Returns:
the nth oldest LogRecord (0 indexed) or undefined if n refers to a log record that hasn't been stored.
Type
module:caplin/core/log/LogRecord

getSize() → {Number}

Returns:
The number of stored log records.
Type
Number

removeListener(id)

Adds a listener the that will be notified if the stored contents changes.
Parameters:
Name Type Description
id Number The id of the listener to be removed (see module:caplin/core/log/LogStoreService#addListener).