Caplin Trader 5.1.0

Interface: module:ct-core/log/LogStoreService

module:ct-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:

 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:ct-core/log/LogStoreService#removeListener).

Type
Number

clear()

Clears all stored log records.

getAllLogRecords() → {Array}

Retrieves all stored log records.

Returns:

an array of module:ct-core/log/LogRecords. Will not be null.

Type
Array

getLogRecord(n) → {module:ct-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:ct-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:ct-core/log/LogStoreService#addListener).