title: How to create rotating file logger on iOS 7/8?
body: <p>I am developing a Beta iOS (7 and 8) app which will be handed to testers soon. </p>
  
  <p>I would like to have a <kbd>send feedback</kbd> button which will send the developers a human description of what went wrong, along with the recent log files.</p>
  
  <p><img src="https://i.stack.imgur.com/sJe7f.png" alt="enter image description here"></p>
  
  <p>Since writing log files can consume a lot of space, I would like to <a href="https://en.wikipedia.org/wiki/Log_rotation" rel="nofollow noreferrer">rotate the files based on their size</a>, like the <a href="http://linuxcommand.org/man_pages/logrotate8.html" rel="nofollow noreferrer">Linux logrotate utility</a>. That is, write the first N log lines to a <code>app.log</code>, then rename <code>app.log</code> to <code>app.log.1</code>, delete the old <code>app.log.1</code> and continue writing to a new <code>app.log</code>. </p>
  
  <p>This way I will have at most <code>2N</code> log lines in the iOS filesystem, and on my error reports.</p>
  
  <p><strong>Is there an open-source, production-ready tool for file log rotation on iOS?</strong></p>