What language? You can find plenty of good examples. We have borrowed from a number of teams (thanks 254) with our base code for next year (java). See
https://github.com/frc-862/valkyrie/ Check out the DataLogger, and, LogWriter, for a reasonable setup.
We log to a USB key, so as to be sure we never fill up the RIO. But if you are careful there is no risk of filling up the RIO in one or two matches.