Xunlei-Fastdick icon indicating copy to clipboard operation
Xunlei-Fastdick copied to clipboard

add datetime to stdout and date to swjsq.log

Open fzinfz opened this issue 9 years ago • 5 comments

add datetime to console output and swjsq.log for easier debugging script failures.

fzinfz avatar Dec 14 '16 08:12 fzinfz

IMHO, it'll be better to use logging instead of writing files manually.

timothyqiu avatar Dec 14 '16 08:12 timothyqiu

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.

fzinfz avatar Dec 14 '16 12:12 fzinfz

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 : )

fffonion avatar Dec 14 '16 14:12 fffonion

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 avatar Apr 15 '17 04:04 fzinfz

@fzinfz Thanks for you contribution anyway !

fffonion avatar Apr 16 '17 04:04 fffonion