report method

void report(
  1. ReportRecord record
)

Filters record and adds the result to reports. If the filter returns null, that record is ignored.

This method is automatically called when a message is added to Logger.

Implementation

void report(ReportRecord record) {
  if (record.level < level) {
    return;
  }

  if (record.object != null && _seenBefore(record.object!)) {
    return;
  }

  if (record.error != null && _seenBefore(record.error!)) {
    return;
  }

  final tRecord = filter(record);

  if (tRecord == null) {
    return;
  }

  final tError = tRecord.error;

  if (tError is PatapataException) {
    scheduleMicrotask(() {
      try {
        tError.onReported(tRecord);
      } catch (e) {
        _print(e.toString());
      }
    });
  }

  _reportStreamController.add(tRecord);
}