@Override
    public void run() {
        LogEntries entries = new LogEntries();
        try {
            while (!Thread.interrupted()) {
                entries = this.logEntriesExchanger.exchange(entries);
                for (int i = 0; i < entries.used; i++) {
                    this.bgLog(entries.lines[i]);
                    entries.lines[i].text.delete(0, entries.lines[i].text.length());
                }
                entries.used = 0;
            }
        } catch (InterruptedException ignored) {

        } finally {
            System.out.println("Warn: logger stopping."); // use standard logging.
        }
    }