private void ApplyFilterChanges() { if (fatalLevel.Checked) { filter.LevelFilter = SystemEventLevel.Fatal; } else if (errorLevel.Checked) { filter.LevelFilter = SystemEventLevel.Error; } else if (warningLevel.Checked) { filter.LevelFilter = SystemEventLevel.Warning; } else if (informationLevel.Checked) { filter.LevelFilter = SystemEventLevel.Information; } else if (debugLevel.Checked) { filter.LevelFilter = SystemEventLevel.Debug; } else { filter.LevelFilter = SystemEventLevel.Trace; } filter.Update(); }
private void ApplyFilterChanges() { filter.TextFilters = filter.TextFilters .Where(placeholder => String.Compare(placeholder.Property, property, StringComparison.OrdinalIgnoreCase) != 0) .Concat(filters.Items.Cast <FilterDefinition>()) .ToList(); filter.Update(); }
public void ThrowExceptionIfUnknownFriendlyFilterName() { var dynamicFilter = new DynamicFilterExpression(StaticFilter) { TextFilters = new[] { FilterDefinition.ForPositiveExpression("Source", "Unknown", "Some Value") } }; Assert.Throws <ArgumentException>(() => dynamicFilter.Update()); }
public void IncludeIfEventProcessIdEqualToAnyProcessFilter(Int32 processId) { var dynamicFilter = new DynamicFilterExpression(StaticFilter) { ProcessFilters = new[] { 2, 4, 8, 16 } }; dynamicFilter.Update(); Assert.False(dynamicFilter.Exclude(new SystemEvent { ProcessId = processId })); }
public void ApplicationNameFilterIsCaseSensitive(String processName) { var dynamicFilter = new DynamicFilterExpression(StaticFilter) { ApplicationFilters = new[] { "Abc" } }; dynamicFilter.Update(); Assert.True(dynamicFilter.Exclude(new SystemEvent { ProcessName = processName })); }
public void IncludeIfEventProcessNameEqualToAnyApplicationFilter(String processName) { var dynamicFilter = new DynamicFilterExpression(StaticFilter) { ApplicationFilters = new[] { "Abc", "Xyz", "123" } }; dynamicFilter.Update(); Assert.False(dynamicFilter.Exclude(new SystemEvent { ProcessName = processName })); }
public void IncludeIfPositiveFilterDefinition() { var dynamicFilter = new DynamicFilterExpression(StaticFilter) { TextFilters = new[] { FilterDefinition.ForPositiveExpression("Source", "Equal To", "Some Value") } }; dynamicFilter.Update(); Assert.False(dynamicFilter.Exclude(new SystemEvent { Source = "Some Value" })); }
public void ExcludeIfNegativeFilterDefinition() { var dynamicFilter = new DynamicFilterExpression(StaticFilter) { TextFilters = new[] { FilterDefinition.ForNegativeExpression("Message", "Equal To", "Some Value") } }; dynamicFilter.Update(); Assert.True(dynamicFilter.Exclude(new SystemEvent { Message = "Some Value" })); }
public void IncludeIfEventLevelGreaterThanOrEqualToLevelFilter(SystemEventLevel level) { var dynamicFilter = new DynamicFilterExpression(StaticFilter) { LevelFilter = SystemEventLevel.Warning }; dynamicFilter.Update(); Assert.False(dynamicFilter.Exclude(new SystemEvent { Level = level })); }
public void ExcludeIfEventLevelLessThanLevelFilter(SystemEventLevel level) { var dynamicFilter = new DynamicFilterExpression(StaticFilter) { LevelFilter = SystemEventLevel.Warning }; dynamicFilter.Update(); Assert.True(dynamicFilter.Exclude(new SystemEvent { Level = level })); }
public void FiltersDefinitionsBySourceProperty() { var textFilters = new[] { FilterDefinition.ForPositiveExpression("Source", "Equal To", "Some Value"), FilterDefinition.ForPositiveExpression("Message", "Equal To", "Another Value") }; var dynamicFilter = new DynamicFilterExpression(StaticFilter) { TextFilters = textFilters }; dynamicFilter.Update(); Assert.False(dynamicFilter.Exclude(new SystemEvent { Source = "Some Value", Message = "Another Value" })); }
private void ApplyFilterChanges() { filter.ApplicationFilters = applications.CheckedItems.Cast <String>().ToList(); filter.Update(); }