Class LogHandlers
Defined in File log_handlers.hpp
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.
- 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.
- Parameters:
ctx – The shared handler context
-
void handle_get_logs(const httplib::Request &req, httplib::Response &res)
Handle 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.
-
void handle_get_logs_configuration(const httplib::Request &req, httplib::Response &res)
Handle GET /{entity-path}/logs/configuration - get log configuration.
-
void handle_put_logs_configuration(const httplib::Request &req, httplib::Response &res)
Handle 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)