Class LogHandlers

Class Documentation

class LogHandlers

Handlers for communication log REST API endpoints.

Provides handlers for:

  • GET /{entity-path}/logs - Query log entries for an entity

  • GET /{entity-path}/logs/configuration - Get log configuration for an entity

  • PUT /{entity-path}/logs/configuration - Update log configuration for an entity

Supported entity types: components, apps, areas, functions.

Log entries are sourced from the /rosout ring buffer by default. If a LogProvider plugin is registered, queries are delegated to it.

PR-403 commit 23: 3 log routes migrated to typed Result<TResponse> shape. The list endpoint uses the typed fan_out_collection<LogEntry> from commit 7 for peer aggregation instead of the legacy merge_peer_items raw-JSON mutator.

Component vs App semantics

Components and areas use prefix matching: all nodes whose FQN starts with the entity namespace are included. Apps use exact FQN matching. Functions aggregate logs from all hosted apps.

Public Functions

inline explicit LogHandlers(HandlerContext &ctx)

Construct log handlers with shared context.

http::Result<dto::Collection<dto::LogEntry, dto::LogListXMedkit>> get_logs(const http::TypedRequest &req)

GET /{entity-path}/logs - query log entries for an entity.

Query parameters: severity - Optional minimum severity filter (debug/info/warning/error/fatal). Stricter of this and entity config severity_filter is applied. context - Optional substring filter applied to the log entry’s node name.

http::Result<dto::LogConfiguration> get_logs_configuration(const http::TypedRequest &req)

GET /{entity-path}/logs/configuration - get log configuration.

http::Result<http::NoContent> put_logs_configuration(const http::TypedRequest &req, dto::LogConfiguration body)

PUT /{entity-path}/logs/configuration - update log configuration.

Body (JSON, all fields optional): severity_filter - Minimum severity to return in query results (debug/info/warning/error/fatal) max_entries - Maximum number of log entries to return per query (> 0)