Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Serial logging to flexible logging #690

Merged
merged 9 commits into from
Dec 22, 2024
Merged

Conversation

mvgalen
Copy link
Collaborator

@mvgalen mvgalen commented Dec 21, 2024

What

This PR reroutes Serial output to a Logging class, which for now only support compile time switching between serial output and web based log output, but this could be made more flexible in the future.
Example output below:
image

Why

To be able to see debug output through the web interface, for installations where serial logging is not very convenient. Also to be able to better see the order in which events etc. are happening.

How

The log output is placed in the same buffer as the web based can_logging, to save on memory and because both are not needed at the same time. If can logging is enabled, the web based logging is disabled. Also placing the output in memory seems to be much less cpu intensive than the serial-logging, where each byte is written separately to the hardware serial.
The display mechanism is the same as for the web based can-logging. Which means that load from the web transfer happens at the moment the user reloads the log page, which can be timed so it happens after the issue that someone may be trying to log and therefore has no influence on the issue.

Add Logging class which inherits from Print class, to be able to route logging to USB Serial or to memory for display in the webpage. Adds a log webpage only visible when DEBUG_VIA_WEB is defined.
@mvgalen mvgalen marked this pull request as draft December 21, 2024 13:15
@mvgalen mvgalen marked this pull request as ready for review December 21, 2024 14:01
@mvgalen mvgalen requested a review from dalathegreat December 22, 2024 12:27
@mvgalen mvgalen merged commit c713d0a into main Dec 22, 2024
92 checks passed
@mvgalen mvgalen deleted the improvement/flexible_logging branch December 22, 2024 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants