title: Output logcat to file and flush buffer without missing any logs
body: <p>Is it possible to output logcat to a file once the buffer is full, then clear the buffer without potentially missing any log messages? </p>
  
  <p>I know logcat -d will output and close, and -c will clear any current logs, but that doesn't seem ideal.</p>
  
  <p>This seems to potentially be a race condition where more logs are sent to logcat in between writing the file and flushing the buffer.</p>