forEachRecord(func) {
    const buffer = this.buffer_;
    // Corner case: no records.
    if (!buffer[0]) {
      return;
    }
    const curIndex = this.curIndex_;
    let i = this.isFull_ ? curIndex : -1;
    do {
      i = (i + 1) % this.capacity_;
      func(/** @type {!goog.log.LogRecord} */ (buffer[i]));
    } while (i !== curIndex);
  }
Calls the given function for each buffered log record, starting with the
oldest one.
TODO(user): Make this a [Symbol.iterator] once all usages of
goog.debug.LogBuffer can be deleted.
@param {!goog.log.LogRecordHandler} func The function to call.