/// <summary> /// Handles when the value changes for a <see cref="CheckBox"/> for a <see cref="Level"/>. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> void LevelCheckBox_ValueChanged(Control sender, EventArgs e) { // Rebuild the list of disabled log levels _disabledLogLevels.Clear(); _disabledLogLevels.AddRange(_logLevelCheckBoxes.Where(x => !x.Value).Select(x => (Level)x.Tag)); // Also add filters to the logger to reject the disabled log levels _logger.ClearFilters(); foreach (var disabledLevel in _disabledLogLevels) { _logger.AddFilter(new LevelMatchFilter { AcceptOnMatch = false, LevelToMatch = disabledLevel }); } }