adafruit / Adafruit_CircuitPython_Bundle

A bundle of useful CircuitPython libraries ready to use from the filesystem.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No way for users to make a log file

TG-Techie opened this issue · comments

I have been making a very layered program that navigates around an deactivates submuodules and launches user side programs (it's a gui with user writable programs) that are dependent on active user input. i have been looking for a way to log the program to a file as it navigates around itself so i can better know what it is doing.

There is no such way to do this while just being able to just unplugging and replugging the drive.

my though it that there could be a file (txt or not, it's all good) on the drive that is marked read only the computer but the drive can wrote to. while i have some ideas of how this could be implemented but they are mostly just conceptual and probably unproductive.

my though is it that code could look like this:

import logio

my_log = logio.internal_log('log_file_name')# or maybe init() or mount()

for i in range(1000):
    if not i % 21:
        my_log.write('a new line of log data (this string) was added when i was:' + str(21))
        #added 'a new line of log data (this string) was added when i was:21' to a new line in the log

then the next time the drive is powered down and up a 'log_file_name.txt' will appear on the drive.
and next time that file is removed and replaced by the new log

while i do not think i can do this alone i will gladly work on the project doing whatever percent of the work i can (while being helpful)

any thoughts on implementing this kinda lib?

See here for how to write files:
https://learn.adafruit.com/circuitpython-essentials/circuitpython-storage
You could use that to do something like a log file.

Closing this since it's more of feature request than an issue with the repo.