Constructor
new ConsoleService()
Classes
Methods
clear()
Clear all logs
.Clear all logs
destroy()
Clean up resources
.Clean up resources
error()
Log error message
.Log error message
exportLogs() → {string}
Export logs as JSON
.Export logs as JSON
Returns:
JSON string of logs
- Type
- string
formatTimestamp(timestamp) → {string}
Format timestamp for display
.Format timestamp for display
Parameters:
| Name | Type | Description | 
|---|---|---|
| timestamp | Date | Timestamp to format | 
Returns:
Formatted time string
- Type
- string
getLogs(levelFilter) → {Array}
Get all logs or filtered logs
.Get all logs or filtered logs
Parameters:
| Name | Type | Default | Description | 
|---|---|---|---|
| levelFilter | string | null | Filter by level or 'all' | 
Returns:
Filtered log entries
- Type
- Array
getStateChanges(oldState, newState) → {Object}
Get differences between two states
.Get differences between two states
Parameters:
| Name | Type | Description | 
|---|---|---|
| oldState | Object | Previous state | 
| newState | Object | New state | 
Returns:
Changed fields
- Type
- Object
getStats() → {Object}
Get console statistics
.Get console statistics
Returns:
Statistics object
- Type
- Object
importLogs(jsonString) → {number}
Import logs from JSON
.Import logs from JSON
Parameters:
| Name | Type | Description | 
|---|---|---|
| jsonString | string | JSON string to import | 
Returns:
Number of logs imported
- Type
- number
info()
Log info message
.Log info message
log(level, message, details)
Add a log entry
.Add a log entry
Parameters:
| Name | Type | Default | Description | 
|---|---|---|---|
| level | string | Log level: 'info', 'success', 'warning', 'error' | |
| message | string | Log message | |
| details | Object | null | Additional details (optional) | 
logOperationError(operation, error, duration)
Log API operation error
.Log API operation error
Parameters:
| Name | Type | Default | Description | 
|---|---|---|---|
| operation | string | Operation name | |
| error | Error | Error object | |
| duration | number | 0 | Duration in milliseconds | 
logOperationStart(operation, params)
Log API operation start
.Log API operation start
Parameters:
| Name | Type | Description | 
|---|---|---|
| operation | string | Operation name (tell, ask, etc.) | 
| params | Object | Operation parameters | 
logOperationSuccess(operation, result, duration)
Log API operation success
.Log API operation success
Parameters:
| Name | Type | Default | Description | 
|---|---|---|---|
| operation | string | Operation name | |
| result | Object | Operation result | |
| duration | number | 0 | Duration in milliseconds | 
logStateChange(type, oldState, newState)
Log state change
.Log state change
Parameters:
| Name | Type | Description | 
|---|---|---|
| type | string | Type of state change | 
| oldState | Object | Previous state | 
| newState | Object | New state | 
notifyListeners(event, data)
Notify all listeners of an event
.Notify all listeners of an event
Parameters:
| Name | Type | Description | 
|---|---|---|
| event | string | Event name | 
| data | Object | Event data | 
sanitizeParams(params) → {Object}
Sanitize parameters for logging (remove sensitive data)
.Sanitize parameters for logging (remove sensitive data)
Parameters:
| Name | Type | Description | 
|---|---|---|
| params | Object | Parameters to sanitize | 
Returns:
Sanitized parameters
- Type
- Object
sanitizeResult(result) → {Object}
Sanitize result data for logging
.Sanitize result data for logging
Parameters:
| Name | Type | Description | 
|---|---|---|
| result | Object | Result to sanitize | 
Returns:
Sanitized result
- Type
- Object
setAutoScroll(enabled)
Set auto-scroll behavior
.Set auto-scroll behavior
Parameters:
| Name | Type | Description | 
|---|---|---|
| enabled | boolean | Whether to auto-scroll | 
setLevelFilter(level)
Set level filter
.Set level filter
Parameters:
| Name | Type | Description | 
|---|---|---|
| level | string | Level to filter by or 'all' | 
subscribe(listener) → {function}
Subscribe to console events
.Subscribe to console events
Parameters:
| Name | Type | Description | 
|---|---|---|
| listener | function | Event listener function | 
Returns:
Unsubscribe function
- Type
- function
success()
Log success message
.Log success message
warning()
Log warning message
.Log warning message