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
add Listener(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.
get All Log Records() → {Array}
Retrieves all stored log records.
Returns:
an array of module:ct-core/log/LogRecord
s. Will not be null.
- Type
- Array
get Log Record(n) → {module:ct-core /log /Log Record}
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.
get Size() → {Number}
Returns:
The number of stored log records.
- Type
- Number
remove Listener(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 |