add datetime to stdout and date to swjsq.log
add datetime to console output and swjsq.log for easier debugging script failures.
IMHO, it'll be better to use logging instead of writing files manually.
I agree with @timothyqiu that logging module is better. Since it requires large modifications, it would be better let @fffonion decide if it's necessary.
In this pull request I just did few safer modifications based on the original code to record timestamp for easier debugging.
I'm not sure if logging is included in the python install of openwrt. We can use logging when available and use plain print as fallback. Also it would be better to wrap this into a function and replace every print with our new function.
For example:
try:
import logging
def _log(s):
logging.log(...)
except ImportError:
def _log(s):
print("%s: %s" % (strftime, s))
And please make sure to consider unicode and python3. Thanks a lot : )
Sorry for late reply. After this post, I migrated this tool from my MPIS32 Debian router to windows Anaconda3 environment running with powershell. It's been running very stable since then, and no login failed issues any more. Since my broadband will be upgraded to 100M directly, I won't use this tool often and won't make further modification probably. Thanks for providing such great tool!
@fzinfz Thanks for you contribution anyway !