M118 Error logging?
-
I'm trying to produce error logging within DWC using M118 but don't see an option for it. Is there not an option for it? If not, could it be added? Thanks
-
-
@chrishamm - any insight on this?
-
I guess there are currently no options for this.. we have found several use cases for manually logging errors and would like to see this added.
@Phaedrux - would you mind moving this thread to the wishlist category?
-
-
@oozebot sorry for the delay in replying @chrishamm and I have been away at Formnext.
If i understand this correctly you would like to use an M118 command to generate a DWC message that shows up as an "error" or "warning" and currently that show up as "info"? This is sperate from saving a M118 output to the log file (which is supported already by RRF).
-
@t3p3tony Yes - we want to programmatically be able to display and log error messages from the SBC. Specifically, the red messages that do not automatically close unless toggled from within DWC.
One example stems from the other thread about reporting actual voltage on the 5v rail. Recently, the 5v power supply on one of our original prototypes began having issues where the RPi was being throttled and we had no idea. Our simple solution was a CRON job every 10 minutes to poll the power state of the RPi, based on the following.
/usr/bin/vcgencmd get_throttled 0 1 Under-voltage detected 1 2 Arm frequency capped 2 4 Currently throttled 3 8 Soft temperature limit active 16 10000 Under-voltage has occurred 17 20000 Arm frequency capping has occurred 18 40000 Throttling has occurred 19 80000 Soft temperature limit has occurred A value of 0x50000 (16+18) means from the boot moment up to now Under-Voltage has occurred.
And then push the results (if non-zero) to DSF like the following. However, there is currently no "L" option for Error logging.
echo m118 P0 S\"Error! Under-voltage detected on the SBC!\" L2 | sudo /opt/dsf/bin/CodeConsole
Thanks!
-
@oozebot For external programs a DSF plugin or a script that uses the proper DSF API would be better. It allows you to send custom messages as well (including error messages), see https://duet3d.github.io/DuetSoftwareFramework/api/DuetAPI.Commands.WriteMessage.html#properties
Unfortunately M118 cannot be used to generate error-type messages.
-
@chrishamm Thanks. I was hoping it would be as simple as adding "L4" as a parameter.
Lnnn Log level of this message (0 = do not log this line, 1 = log as WARN, 2 = log as INFO, 3 = log as DEBUG (default)) (RRF >= 3.2.0-beta3)
The API is interesting. Any examples calling it from Bash?
-
@oozebot I don't think there is a bash API client yet but you could use the Python one from https://github.com/Duet3D/dsf-python
-
I'm marking this as solved. We were able to accomplish what we wanted through dsf-python as @chrishamm suggested.
For posterity, see this thread: https://forum.duet3d.com/topic/26090/dsf-python-script-to-monitor-sbc-and-log-results-through-dsf
-