release method

List<SpringLogRecord> release()

Stops holding and emits, in order, the held records that pass the current level of their logger, or hands them to an outer hold if one is still active. Returns the records it passed on. A second call does nothing and returns an empty list.

Implementation

List<SpringLogRecord> release() {
  if (!SpringLog._holds.remove(this)) {
    return const [];
  }
  final passed = [
    for (final record in _records)
      if (record.level != SpringLogLevel.off &&
          (SpringLog._holds.isNotEmpty ||
              record.level.index >=
                  SpringLog.levelOf(record.loggerName).index))
        record,
  ];
  _records.clear();
  passed.forEach(SpringLog._dispatch);
  return passed;
}