question: public void save ( OnSaveLogListener listener ) { File dir = getLogDir ( ) ; if ( dir == null ) { listener . onError ( "Can't save logs. External storage is not mounted. " + "Check android.permission.WRITE_EXTERNAL_STORAGE permission" ) ; return ; } FileWriter fileWriter = null ; try { File output = new File ( dir , getLogFileName ( ) ) ; fileWriter = new FileWriter ( output , true ) ; List < LogEntry > entries = bufferedLogs ( ) ; for ( LogEntry entry : entries ) { fileWriter . write ( entry . prettyPrint ( ) + "\n" ) ; } listener . onSave ( output ) ; } catch ( IOException e ) { listener . onError ( e . getMessage ( ) ) ; e . printStackTrace ( ) ; } finally { if ( fileWriter != null ) { try { fileWriter . close ( ) ; } catch ( IOException e ) { listener . onError ( e . getMessage ( ) ) ; e . printStackTrace ( ) ; } } } }
target:  Save the current logs to disk.