Constructor
new module:ct-core /log /Store Logger(level, max Records)
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 |
|
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
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. |
- Inherited From:
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.
- Inherited From:
debug()
Log a 'debug' message.
A variable argument method. See module:ct-core/log/Log.interpolate
for more information.
- Inherited From:
error()
Log an 'error' message.
A variable argument method. See module:ct-core/log/Log.interpolate
for more information.
Avoid using this method, as it is intended only to be used at the top level.
- Inherited From:
get All Log Records() → {Array}
Retrieves all stored log records.
- Inherited From:
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. |
- Inherited From:
Returns:
the nth oldest LogRecord (0 indexed) or undefined if n refers to a log record that hasn't been stored.
get Size() → {Number}
- Inherited From:
Returns:
The number of stored log records.
- Type
- Number
info()
Log an 'info' message.
A variable argument method. See module:ct-core/log/Log.interpolate
for more information.
- Inherited From:
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 |
- Inherited From:
trace()
Log a 'trace' message.
A variable argument method. See module:ct-core/log/Log.interpolate
for more information.
- Inherited From:
warn()
Log a 'warn' message.
A variable argument method. See module:ct-core/log/Log.interpolate
for more information.
- Inherited From:
(inner) add Listener() → {Number}
Returns:
The number of log messages stored.
- Type
- Number
(inner) clear()
Clears all log records that have been stored in this StoreLogger.
(inner) dump() → {String}
Provides all of the stored log information as a string.
Returns:
a string containing all the logged records.
- Type
- String
(inner) get All Log Records() → {Array}
Provides all of the stored log information.
Returns:
an array of module:ct-core/log/LogRecord
s.
- Type
- Array
(inner) 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.
(inner) get Size() → {Number}
Returns:
The number of log messages stored.
- Type
- Number
(inner) log(level, log Data)
Stores the time and all the log information internally.
Parameters:
Name | Type | Description |
---|---|---|
level |
String | the name of the method that was called. |
logData |
Array | the log information. |
(inner) register(class Patternopt)
Registers this logger as a module:ct-core/log/LogStoreService
with the ServiceRegistry
and as a module:ct-core/log/Logger
with the EventHub (to receive log messages).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
classPattern |
String |
<optional> |
a pattern to restrict which messages the logger receives. |
(inner) remove Listener() → {Number}
Returns:
The number of log messages stored.
- Type
- Number