I have a python script, it contains print
statements here and there for debugging purposes. Now I find it hard to read them in console. Does python have any libraries which will automatically direct all print
statements' outputs to a specified text file? I use Windows 7 by the way, not Linux. I also don't run my scripts from command line.
So what I want is something like below:
import logger_module
log_file = "log.txt"
logger_module.activate_logging(log_file)
print "blablabla"
When I run the script above, I should see "blablabla" in log.txt
file.