query method

List<AuditEntry> query({
  1. String? moduleId,
  2. AuditType? type,
  3. DateTime? since,
  4. DateTime? until,
  5. AuditSeverity? minSeverity,
  6. bool? successOnly,
})

Query audit entries

Implementation

List<AuditEntry> query({
  String? moduleId,
  AuditType? type,
  DateTime? since,
  DateTime? until,
  AuditSeverity? minSeverity,
  bool? successOnly,
}) {
  return _entries.where((e) {
    if (moduleId != null && e.moduleId != moduleId) return false;
    if (type != null && e.type != type) return false;
    if (since != null && e.timestamp.isBefore(since)) return false;
    if (until != null && e.timestamp.isAfter(until)) return false;
    if (minSeverity != null && e.severity.index < minSeverity.index) {
      return false;
    }
    if (successOnly != null && e.success != successOnly) return false;
    return true;
  }).toList();
}