private bool RemoveExcludeTag(string tag) { if (!ExcludeTags.Contains(tag)) { return(false); } return(ExcludeTags.Remove(tag)); }
private bool AddExcludeTag(string tag) { if (ExcludeTags.Contains(tag)) { return(false); } ExcludeTags.Add(tag); return(true); }
/// <summary> /// Tests whether an error record applies to the provider instance /// </summary> /// <param name="Record">The error record to test</param> /// <returns>Whether it applies to the provider instance</returns> public bool MessageApplies(Message.PsfExceptionRecord Record) { // Modules if (IncludeModules.Count > 0) { bool test = false; foreach (string module in IncludeModules) { if (string.Equals(Record.ModuleName, module, StringComparison.InvariantCultureIgnoreCase)) { test = true; } } if (!test) { return(false); } } foreach (string module in ExcludeModules) { if (string.Equals(Record.ModuleName, module, StringComparison.InvariantCultureIgnoreCase)) { return(false); } } // Functions if (IncludeFunctions.Count > 0) { bool test = false; foreach (string function in IncludeFunctions) { if (UtilityHost.IsLike(Record.FunctionName, function)) { test = true; } } if (!test) { return(false); } } foreach (string function in ExcludeFunctions) { if (UtilityHost.IsLike(Record.FunctionName, function)) { return(false); } } // Tags if (IncludeTags.Count > 0) { if (IncludeTags.Except(Record.Tags).ToList().Count == IncludeTags.Count) { return(false); } } if (ExcludeTags.Except(Record.Tags).ToList().Count < ExcludeTags.Count) { return(false); } return(true); }
/// <summary> /// Tests whether a log entry applies to the provider instance /// </summary> /// <param name="Entry">The Entry to validate</param> /// <returns>Whether it applies</returns> public bool MessageApplies(Message.LogEntry Entry) { // Level if (!IncludeWarning && (Entry.Level == Message.MessageLevel.Warning)) { return(false); } if (((_MinLevel != 1) || (_MaxLevel != 9)) && (Entry.Level != Message.MessageLevel.Warning)) { if (Entry.Level < (Message.MessageLevel)_MinLevel) { return(false); } if (Entry.Level > (Message.MessageLevel)_MaxLevel) { return(false); } } // Modules if (IncludeModules.Count > 0) { bool test = false; foreach (string module in IncludeModules) { if (string.Equals(Entry.ModuleName, module, StringComparison.InvariantCultureIgnoreCase)) { test = true; } } if (!test) { return(false); } } foreach (string module in ExcludeModules) { if (string.Equals(Entry.ModuleName, module, StringComparison.InvariantCultureIgnoreCase)) { return(false); } } // Functions if (IncludeFunctions.Count > 0) { bool test = false; foreach (string function in IncludeFunctions) { if (UtilityHost.IsLike(Entry.FunctionName, function)) { test = true; } } if (!test) { return(false); } } foreach (string function in ExcludeFunctions) { if (UtilityHost.IsLike(Entry.FunctionName, function)) { return(false); } } // Tags if (IncludeTags.Count > 0) { if (IncludeTags.Except(Entry.Tags, StringComparer.InvariantCultureIgnoreCase).ToList().Count == IncludeTags.Count) { return(false); } } if (ExcludeTags.Except(Entry.Tags, StringComparer.InvariantCultureIgnoreCase).ToList().Count < ExcludeTags.Count) { return(false); } return(true); }
public bool HasTagFilters() { return(IncludeTags.Any() || ExcludeTags.Any()); }
public bool ExcludesAny(List <string> tags) { return(ExcludeTags.Any() && ExcludeTags.Intersect(tags).Any()); }
public bool Excludes(string tag) { return(ExcludeTags.Any() && ExcludeTags.Contains(tag)); }