Im looking for a way in which the program can log specific errors/conditions(user-defined) as and when such conditions occur, and while the code is running I can give command to read it and interpret it in a readable format such a .txt or .xls etc.
What I have thought so far is implementing something like this in my code:
Create a circular buffer
When a specific error occurs, write the details into the circular buffer Create a routine that always monitors for a request over UART(or any other comm port)
When request is received, send the data over the Comm port. Interpret and populate the received data into a excel sheet(maybe using python).
Are there any other better ways I can create a Trace Log?
Is there a way such that even when an error occurs, and the code is stuck, I wont be dependent on the code functionality to read the Trace buffer entries(so that I can analyze at what point in code flow the code got stuck)