LogsSupervisor#
- class ansys.solutions.dash_super_components.LogsSupervisor(log_file: Path | str, log_format: str, aio_id: str | None = None, interval: int = 3000, width: str | int = '100%', grid_props: dict[str, Any] | None = None, show_error_notifications: bool = True)#
Bases:
DivA Dash component for parsing and displaying log files in an interactive AG Grid table.
LogsSupervisor is based on the Dash All-in-One (AIO) component pattern. It parses log files generated with Python’s
loggingmodule and renders them in a sortable, filterable AG Grid table with per-level filter buttons and an optional real-time monitoring toggle.The grid shows contextual no-rows messages depending on parsing outcome:
missing source (for example, file not found or URL 404),
parse failure or no rows matching the provided format,
successful parse with no rows to display.
Optional
dmcnotifications can be emitted for parse failures.The
log_formatmust exactly match the formatter used in the logger, for example:"%(asctime)s - %(levelname)s - %(module)s - %(message)s"
To activate real-time monitoring from a callback use:
LogsSupervisor.ids.activate_monitoring(aio_id) # Store; set "data" to True
Note
Custom JavaScript assets must be registered for the log level badges and contextual no-rows messages to render correctly. See the Getting Started page for instructions on registering component assets (
add_super_components_assets()andexternal_scripts).Furthermore, for error notifications to work correctly, a
dmc.NotificationContainermust be present in the application layout. By default the container ID is"notification-container"; useconfigure()to change it.- Parameters:
- log_file
strorPath Path or URL to the log file. Accepts local file paths and HTTP/HTTPS URLs.
- log_format
str Format string matching the logger’s formatter. Determines which columns are displayed. See Python logging attributes.
- aio_id
str,optional Unique identifier for this component instance. A UUID is generated when not provided.
- interval
int,optional Polling interval in milliseconds when monitoring is active. Default is
3000.- width
strorint,optional Width of the component container. CSS string (
"70%","800px") or integer (pixels). Default is"100%".- grid_props
dict,optional Additional properties forwarded to the AG Grid component.
- show_error_notifications
bool,optional Whether to emit
dmcerror notifications when parsing fails. Default isTrue.
- log_file
IDs
- class ansys.solutions.dash_super_components.LogsSupervisor.LogsSupervisorIds#
Bases:
AIOIdsProvides IDs for the subcomponents of
LogsSupervisor.- classmethod activate_monitoring(aio_id: str | Wildcard) dict[str, Any]#
Return the ID for the activate monitoring store component.
This component can be used to externally control the activation of the monitoring by setting its
dataproperty toTrueorFalse.
- classmethod critical_button(aio_id: str | Wildcard) dict[str, Any]#
Return the ID for the critical button component.
- classmethod debug_button(aio_id: str | Wildcard) dict[str, Any]#
Return the ID for the debug button component.
- classmethod error_button(aio_id: str | Wildcard) dict[str, Any]#
Return the ID for the error button component.