/// <summary>
        /// Full constructor.
        /// </summary>
        /// <param name="sources">A list of strings containing the sources checked by this filter. Matching is case sensitive.</param>
        /// <param name="filterType">A value from the <seealso cref="FilterConditionStyle"/> enum determining whether the values in <paramref name="sources"/> are included or excluded.</param>
        public LogEventSourceFilter(IEnumerable <string> sources, FilterConditionStyle filterType)
        {
            if (sources == null)
            {
                throw new ArgumentNullException(nameof(sources));
            }

            _Sources    = sources.ToArray();
            _FilterType = filterType;
        }
Exemple #2
0
        /// <summary>
        /// Full constructor. Takes a <see cref="LogEventType"/> value that will be included or excluded by this filter.
        /// </summary>
        /// <param name="propertyName">The name of the property that must exist in the log event for it to pass the filter.</param>
        /// <param name="filterCondition">A <see cref="FilterConditionStyle"/> value that indicates whether <paramref name="propertyName"/> is included or excluded.</param>
        public HasPropertyFilter(string propertyName, FilterConditionStyle filterCondition)
        {
            if (propertyName == null)
            {
                throw new ArgumentNullException(nameof(propertyName));
            }
            if (String.IsNullOrWhiteSpace(propertyName))
            {
                throw new ArgumentException(String.Format(System.Globalization.CultureInfo.CurrentCulture, Properties.Resources.PropertyCannotBeEmptyOrWhitespace, propertyName), nameof(propertyName));
            }

            _PropertyName    = propertyName;
            _FilterCondition = filterCondition;
        }
Exemple #3
0
        /// <summary>
        /// Full constructor. Takes a <see cref="LogEventType"/> value that will be included or excluded by this filter.
        /// </summary>
        /// <param name="partialText">The substring the <see cref="LogEvent.EventName"/> property must contain (cased ignored) to pass the filter.</param>
        /// <param name="filterCondition">A <see cref="FilterConditionStyle"/> value that indicates whether <paramref name="partialText"/> is included or excluded.</param>
        public MessageContainsTextFilter(string partialText, FilterConditionStyle filterCondition)
        {
            if (partialText == null)
            {
                throw new ArgumentNullException(nameof(partialText));
            }
            if (String.IsNullOrWhiteSpace(partialText))
            {
                throw new ArgumentException(String.Format(System.Globalization.CultureInfo.CurrentCulture, Properties.Resources.PropertyCannotBeEmptyOrWhitespace, partialText), nameof(partialText));
            }

            _PartialText     = partialText;
            _FilterCondition = filterCondition;
        }
 /// <summary>
 /// Full constructor. Takes a <see cref="LogEventType"/> value that will be included or excluded by this filter.
 /// </summary>
 /// <param name="eventType">A value from the <see cref="LogEventType"/> checked by this filter.</param>
 /// <param name="filterCondition">A <see cref="FilterConditionStyle"/> value that indicates whether <paramref name="eventType"/> is included or excluded.</param>
 public LogEventTypeFilter(LogEventType eventType, FilterConditionStyle filterCondition)
 {
     _EventType       = eventType;
     _FilterCondition = filterCondition;
 }