How to write stdout both to the terminal and a file | Curious Programmer