SlimeVR / SlimeVR-Tracker-ESP

SlimeVR tracker firmware for ESP32/ESP8266 and different IMUs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make the logs have unique id for each message in front of each log line

loucass003 opened this issue · comments

In the gui or the server there is instances where we look for some specific lines of logs in the serial to do other actions.
it can causes issues if someone decides to change de text of that log line to something else and forget to change the server or gui that are lookig for it.

My proposal is that each log lines have their unique id. kinda like error id but for everything. Log lines that hold data would be the execption because you have to actually parse the log line to get data. but for all the others like

looking for server...
handshake successfull

it would be better to have something like

{1} looking for server ....
{34} handshake successfull ...

that way code inside the server could just use the id as a reference instead of the log text

Good suggestion, someone implement plz 🥺

Does the firmware (not the server side) provide the id as above? If that's correct, server can easily figure out the stored Wi-Fi credentials or IMU state without parsing the serial console on the server side. Let's think about how the server can easily parse it without compromising readability.

The Firmware does not have any kind of text-IDs or event-IDs. Translations of the Firmware do currently break the detection in the WebFlasher. Probably also in the Server.
Current Log format is:
[LOGLEVEL] [Modul] Text\n
"[%-5s] [%s] %s\n" ( https://github.com/SlimeVR/SlimeVR-Tracker-ESP/blob/main/src/logging/Logger.cpp#L79 )

Maybe we can add a [Xabbcccc]
a = loglevel 4bit
b = modul 8bit
c = messageid 16bit (unique per modul?)