public IQueue Filter(IQueue queue) { var records = new List <Record>(queue.Count); foreach (var log in queue) { if (log.Type == RecordType.Record && _logLevel <= log.Severity) { records.Add(log); } } return(queue.CloneWith(records)); }
public IQueue Filter(IQueue queue) { var records = new List <Record>(queue.Count); int?endDepth = null; foreach (var log in queue) { var lowercase = log.CategoryName.ToLower() ?? ""; var isIncluded = _classes.Any(c => lowercase.StartsWith(c)); if (endDepth == null && isIncluded) { endDepth = log.Depth; } if (endDepth != null && log.Depth >= endDepth.Value) { records.Add(log); } } return(queue.CloneWith(records)); }