How to write errors and warnings to a log file?

Viewed 5947

I have written an R function that downloads a list of files from an official statistics website. Some of the downloads fail and I would like to keep track of the error message.

This answer suggest using sink(logfilename, type="message") to divert error messages to a text file but the sink help page says:

"Do not sink the messages stream unless you understand the source code implementing it and hence the pitfalls."

What are the pitfalls and is there an alternative to using sink?

1 Answers
Related