Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/craigpeacock/esp32_websocket_logviewer
Redirects esp32 console in realtime to webpage using websockets. Using esp-idf.
https://github.com/craigpeacock/esp32_websocket_logviewer
console esp-idf logfile realtime websocket
Last synced: 6 days ago
JSON representation
Redirects esp32 console in realtime to webpage using websockets. Using esp-idf.
- Host: GitHub
- URL: https://github.com/craigpeacock/esp32_websocket_logviewer
- Owner: craigpeacock
- License: gpl-3.0
- Created: 2023-10-02T10:29:06.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-02T11:18:16.000Z (about 1 year ago)
- Last Synced: 2023-10-03T18:09:18.998Z (about 1 year ago)
- Topics: console, esp-idf, logfile, realtime, websocket
- Language: C
- Homepage:
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ESP32 Websocket based Real Time Log Viewer
This example redirects the esp32 console in real-time to webpage using websockets. Developed using [esp-idf](https://www.espressif.com/en/products/sdks/esp-idf).This application dynamically redirects the esp console to the web browser when the user presses the start button and stops the redirection when pressing stop. Redirection is performed using the
[``esp_log_set_vprintf()``](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/log.html#_CPPv419esp_log_set_vprintf14vprintf_like_t) function.The esp-idf log framework highlights the different log levels using colours specified by [ANSI Escape Codes](https://en.wikipedia.org/wiki/ANSI_escape_code). These codes are stripped out using the ``remove_ansi_escape_codes()`` function prior to sending down the websocket.
Javascript running on the client side replaces greater than and less than symbols with the correct HTML codes to provide HTML compliance. When the end user presses the save button, the various elements making up the log file is iterated and saved to file. This provides a real-time interface without any flash wear that could occur if files are written to SPIFFS and retrieved.
When the log panel becomes full, a scroll bar will appear and the last lines are shown similar to a ``tail -f``.