Report question

Question: In linux, how can I test whether the output of a program is going to a live terminal or to a file?