I created a test tool for QA in Python that sends commands on Serial or USB ports (as well as TCP/IP, XML) and uses the console to display the output [ SENT ]: xyz [RECEIVED]: abc [EXPECTED]: abc [ RESULT ]: PASS
QA wants this logged to a text file of their choice; so I told them to run the .py file with the > redirect (test.py > log.txt) as a temporary solution.
Is there an easy way of having the console output doubled to a file as well? I looked at the standard Python logging module and I didn't find it usefull.
Perfect solution would be if I can import something in my main run file and create a new instance (thread) with a "path\\filename.txt" variable, and this would hook the console output and send it to a file without me having to change any other files.