somakeit / smib

1 stars 0 forks source link

File based logging for SMIBHID #125

Closed sam57719 closed 1 month ago

sam57719 commented 1 month ago

SD Card module for SMIBHID pi pico devices to allow local storage of logs.

Useful for debugging issues with production installations.

SD Card breakout hardware

I believe there is an existing micropython sdcard library.

An alternative would be dumping files to a network drive but that relies on the network connection.

sjefferson99 commented 1 month ago

I was thinking about this recently. If we store logs they should be local, however sd card storage is relatively complex for the value even with the existing libraries and relies on SPI.

The flash on board is just as good as sd card for storage with simple file calls and log rotation and cheaper to just replace whole pico if writes are exhausted. There is logging logic in the pimoroni enviro project we can base it on.

Also, we can make file logging a config value and only enable if problems are being experienced to save write wear. A problem needs to happen at least twice (once after enabling logging) to be worth looking into.

sjefferson99 commented 1 month ago

@sam57719 Propose we rename the issue to enable file based logging for SMIBHID and discuss the above for specific implementation.

sjefferson99 commented 1 month ago

Started work on making logging module process one or more output handlers configurable in config.py and building a file output handler.