Open Aezore opened 6 years ago
This sounds like a nice feature, which could be really useful for users who make many or longer runs.
Logging e.g. script arguments, start time, end time, result summary, reason for quitting etc would give a nice, basic event log for each session. This could even be controlled by a log level value in a configuration file, so that the behavior can be persistently controlled without having to pass a log level argument each time CC is run. This would also be a reasonable place to set the maximum log size.
I like the idea. Any additional thoughts or input on this proposal are of course welcome.
It can be set in the .canrc config file as a "log verbosity" level. I propose this keys: [logging] reportlevel = FULL/MIN/ERROR/NONE reportsize = reportfile = SESSION/APPEND
As report levels for FULL would be full timestamped canbus settings (as canbus speed and protocol), commands and results, errors, and some other minor system related stuff like kernel version and stuff like that. MIN would be timestamped discovered addresses or commands issued and if they were successful or not. ERROR would be just errors like no communications, canbus errors, and other related stuff.
Size I think it would be nice to be suffix-sensitive as 16M in megabytes.
File would mean if it creates just a single job report with all sessions appended or one log file for each session.
Since .canrc
is not specific to Caring Caribou (but rather belongs to the underlying python-can library), we should not be modifying its contents. I would prefer a configuration file located within the project itself.
It would make sense to utilize the logging
python module to handle different log levels. This way, the setting from the configuration file could simply be used to initiate a call with a matching level to logging.setLevel
I suggest adding an appended log recorder, like a blackbox with datetimed results and user actions, with an user-setting for "how big" the log should be and trim it if needed. So in case you need to review some data or behaviour not within the session but another day or week even..as far as the log file size is set, in plain human readable text. This might be helpful as it really comes in handy sometimes on my Dataman chip programmer to actually double check if I did program a chip in the past and what data was loaded into.