Item one was easy - had commented out a line to ease debugging. Forgot to uncomment!
Still a good question
Fixing error recording was easy. Working that out, not so much. Fixed logging to file, defined in the main thread then used by wrapping each thread function in a try ... except, which calls ProcessError, which in turn writing the traceback to the log file. https://github.com/SteveCossy/IOT/commit/138271f66e49dbe71ee992c947d4a16b99f4c4a5
Currently completed wrapping the Serial thread. Still need to wrap the others.
It appears that LoRaReAd/Thread_to_MQTT.py Save2CSV (CSVPath, ClientID, Channel, Data) does not appear to be sending Channel data.
Status indication is now 1 for success, 0 for failure. It used to be the other way round. Which is best? https://github.com/SteveCossy/IOT/blob/b5426d0680d0b751686093f47f1e7bb7c62d9f24/LoRaReAd/SensorLib.py#L96 lines 96 & 101
Oops! Did I really not put any error handling in Thread_to_MQTT? Now it is crashing daily, I don't know why and don't have time to work it out! I need to put a version of lines 153 to 160 of this code: https://github.com/SteveCossy/IOT/blob/master/LoRaReAd/LoRa_to_MQTT.py into this code: https://github.com/SteveCossy/IOT/blob/master/LoRaReAd/Thread_to_MQTT.py (In the meantime I'm going to reboot the Pi at 1am each day.)