public void processFiles(List<File> files, Function<LoggerEntry, Boolean> transport) {
        for (File f : files) {
            log.log(Level.FINE, "Processing file " + f);
            boolean success = false;
            try {
                List<String> lines = Files.readAllLines(f.toPath());
                for (String line : lines) {
                    LoggerEntry entry = LoggerEntry.deserialize(line);
                    log.log(Level.FINE, () -> "Read entry " + entry + " from " + f);
                    success = transport.apply(entry);
                    if (! success) {
                        throw new RuntimeException("Unable to process file " + f + ": unsuccessful call to transport() for " + entry);
                    }
                }
                failures.remove(f);
            } catch (Exception e) {
                handleFailure(f);
            } finally {
                if (success) {
                    if (keepSuccessFiles)
                        moveProcessedFile(f, successesPath);
                    else
                        try {
                            Files.delete(f.toPath());
                        } catch (IOException e) {
                            log.log(Level.WARNING, "Unable to delete file " + f, e);
                        }
                }
            }
        }
    }
Spooler that will write an entry to a file and read files that are ready to be sent.
Files are written in JSON Lines text file format.

@author hmusum
container-search/src/main/java/com/yahoo/search/logging/Spooler.java