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

Use structured logging #61

Open
nateinaction opened this issue Dec 24, 2024 · 1 comment
Open

Use structured logging #61

nateinaction opened this issue Dec 24, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@nateinaction
Copy link
Member

nateinaction commented Dec 24, 2024

Debugging is important and human readable logs are great but what if we wanted to create automated tooling that processed those logs? Structured logging causes debug output to enter logs in json format making it easier for machines to parse.

https://docs.python.org/3/howto/logging-cookbook.html#implementing-structured-logging

Implementing structured logging could allow us to more easily automate something like a radio test between FC boards that runs on every commit.

@blakejameson blakejameson self-assigned this Jan 3, 2025
@Mikefly123
Copy link
Member

Related to this task, I just wanted to link the adafruit_logging documentation alongside its related tutorial. A quick skim of the repo for this, it looks somewhat more limited than the default Python logging api, but it should still work well for our use case.

I think a good place to start would probably be to consider replacing all of the debug_print() and error_print() statements in our code with logging statements instead. One thing to note, due to the limitations of CircuitPython, if we decide we want to log to a file within CircuitPython's internal file system we will first need to solve the issue of how to transition between readonly and non-readonly file systems.

From CircuitPython Essentials

The CIRCUITPY drive is typically writable by your computer; this is what allows you to edit your code directly on the board. The reason you need a boot.py file is that you have to set the filesystem to be read-only by your computer to allow it to be writable by CircuitPython. This is because CircuitPython cannot write to the filesystem at the same time as your computer. Doing so can lead to filesystem corruption and loss of all content on the drive, so CircuitPython is designed to only allow one at at time

@Mikefly123 Mikefly123 added the enhancement New feature or request label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

4 participants