log_stream.h 711 B

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #include "esp_err.h"
  3. #include "esp_http_server.h"
  4. /**
  5. * WebSocket-based log streaming.
  6. *
  7. * Hooks into esp_log via esp_log_set_vprintf() to capture all log output
  8. * into a ring buffer. Connected WebSocket clients on /ws/logs receive
  9. * log lines in real-time. Logs continue to go to UART as normal.
  10. *
  11. * Requires CONFIG_HTTPD_WS_SUPPORT=y in sdkconfig.
  12. */
  13. /**
  14. * Initialize the log capture ring buffer and hook esp_log output.
  15. * Call before web_server_start() so early logs are captured.
  16. */
  17. esp_err_t log_stream_init(void);
  18. /**
  19. * Register the /ws/logs WebSocket handler on the given HTTP server
  20. * and start the broadcast task.
  21. */
  22. esp_err_t log_stream_register(httpd_handle_t server);