Constructor
new module:caplin/core/log/StoreLogger(level, maxRecords)
Constructs a StoreLogger.
Extends:
Parameters:
Name | Type | Description |
---|---|---|
level |
the most detailed level at which to output log messages.
Should be one of the levels defined statically on module:caplin/core/log/AbstractLogger .
Will default to INFO level if not provided. |
|
maxRecords |
Number | 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. |
Extends
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. - Inherited From:
Returns:
An id for the listener that can be used to remove it (seemodule:caplin/core/log/LogStoreService#removeListener
).- Type
- Number
-
clear()
-
Clears all stored log records.
- Inherited From:
-
getAllLogRecords() → {Array}
-
Retrieves all stored log records.
- Inherited From:
Returns:
an array ofmodule:caplin/core/log/LogRecord
s. 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. - Inherited From:
Returns:
the nth oldest LogRecord (0 indexed) or undefined if n refers to a log record that hasn't been stored. -
getSize() → {Number}
-
- Inherited From:
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
).- Inherited From: