Streaming terminal output to a file