-
Notifications
You must be signed in to change notification settings - Fork 0
EventLog
The OdinEventLog component provides a display for log messages that may be provided by an Odin Control Adapter. Log messages consist of a message, a timestamp, and optionally a level similar to the logging levels available.
The log display provides an auto scrolling container that will show the latest logs, up to a specified number, and some filter options. Logs can be filtered by timestamp to display only logs before/after a certain time, and if provided, filtered by log level.
Note
The auto scroll feature can be toggled by a button within the component. Additionally, by default the display does not show the date from the timestamp, only the time, but this too can be toggled via a button.
Important
If the component is getting the log messages directly from an Endpoint, it utilizes Query Parameters to request only the logs it does not yet have, by passing it's most recent timestamp to the Adapter. If the Adapter does not parse Query Parameters and instead returns all the logs every time, this could cause doubling of the displayed logs.
import { OdinEventLog } from 'odin-react';
import type { Log } from 'odin-react';| Name | Type | Description |
|---|---|---|
| timestamp | string |
Required The log message's timestamp, as any string that can initialise a javascript Date Object
|
| message | string |
Required The Actual message of the log. |
| level | "debug" | "info" | "warning" | "error" | "critical" |
If provided, will set the level of the log, changing the way it gets rendered by the component. |
| Name | Type | Default | Description |
|---|---|---|---|
| events | Log[] |
Required A list of Logs, based on the above Interface, to initialise the Log Display |
|
| refreshRate | number |
1000 |
Sets the number of milliseconds that the Log Display will look to refresh it's logs. |
| displayHeight | CSSProperties.Height |
"330px" |
The height of the box that displays the logs. |
| maxLogs | number |
500 |
The maximum number of logs to display. If there are more available, the oldest will be truncated |
| getLatestLogs | (timestamp: string) => Log[] |
If provided, the Log Display will refresh it's log list by calling this method. This method cannot be provided if endpoint has been provided.
|
|
| endpoint | AdapterEndpoint_t |
The endpoint that the Log Display can request logs from. Cannot be provided if getLatestLogs has been instead.
|
|
| path | string |
The path to the logs on the Adapter's Parameter tree. Required if endpoint has been provided. Cannot be provided if getLatestLogs has instead
|