<commit_before>// 
// Copyright (c) 2004-2006 <NAME> <<EMAIL>>
// 
// All rights reserved.
// 
// Redistribution and use in source and binary forms, with or without 
// modification, are permitted provided that the following conditions 
// are met:
// 
// * Redistributions of source code must retain the above copyright notice, 
//   this list of conditions and the following disclaimer. 
// 
// * Redistributions in binary form must reproduce the above copyright notice,
//   this list of conditions and the following disclaimer in the documentation
//   and/or other materials provided with the distribution. 
// 
// * Neither the name of <NAME> nor the names of its 
//   contributors may be used to endorse or promote products derived from this
//   software without specific prior written permission. 
// 
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
// THE POSSIBILITY OF SUCH DAMAGE.
// 

using System;
using System.Collections;
using System.Collections.Specialized;
using System.Text;
using System.Globalization;

using NLog;
using NLog.Targets;
using NLog.Filters;

namespace NLog.Config
{
    /// <summary>
    /// Represents a logging rule. An equivalent of &lt;logger /&gt; configuration element.
    /// </summary>
    public class LoggingRule
    {
        internal enum MatchMode
        {
            All, None, Equals, StartsWith, EndsWith, Contains, 
        } 

        private string _loggerNamePattern;
        private MatchMode _loggerNameMatchMode;
        private string _loggerNameMatchArgument;

        private bool[]_logLevels = new bool[LogLevel.MaxLevel.Ordinal + 1];
        private TargetCollection _targets = new TargetCollection();
        private FilterCollection _filters = new FilterCollection();
        private LoggingRuleCollection _childRules = new LoggingRuleCollection();
        private bool _final = false;

        /// <summary>
        /// Returns a string representation of <see cref="LoggingRule"/>. Used for debugging.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(CultureInfo.InvariantCulture, "logNamePattern: ({0}:{1})", _loggerNameMatchArgument, _loggerNameMatchMode);
            sb.Append(" levels: [ ");
            for (int i = 0; i < _logLevels.Length; ++i)
            {
                if (_logLevels[0])
                    sb.AppendFormat(CultureInfo.InvariantCulture, "{0} ", LogLevel.FromOrdinal(i).ToString());
            }
            sb.Append("] appendTo: [ ");
            foreach (Target app in _targets)
            {
                sb.AppendFormat(CultureInfo.InvariantCulture, "{0} ", app.Name);
            }
            sb.Append("]");
            return sb.ToString();
        }

        /// <summary>
        /// A collection of targets that should be written to when this rule matches.
        /// </summary>
        public TargetCollection Targets
        {
            get { return _targets; }
        }

        /// <summary>
        /// A collection of child rules to be evaluated when this rule matches.
        /// </summary>
        public LoggingRuleCollection ChildRules
        {
            get { return _childRules; }
        }

        /// <summary>
        /// A collection of filters to be checked before writing to targets.
        /// </summary>
        public FilterCollection Filters
        {
            get { return _filters; }
        }

        /// <summary>
        /// Quit processing any further rule when this one matches.
        /// </summary>
        public bool Final
        {
            get { return _final; }
            set 
            { 
                _final = value; 
            }
        }

        /// <summary><commit_msg>formatted trivial get/set statements into single line<commit_after>// 
// Copyright (c) 2004-2006 <NAME> <jaak<EMAIL>>
// 
// All rights reserved.
// 
// Redistribution and use in source and binary forms, with or without 
// modification, are permitted provided that the following conditions 
// are met:
// 
// * Redistributions of source code must retain the above copyright notice, 
//   this list of conditions and the following disclaimer. 
// 
// * Redistributions in binary form must reproduce the above copyright notice,
//   this list of conditions and the following disclaimer in the documentation
//   and/or other materials provided with the distribution. 
// 
// * Neither the name of <NAME> nor the names of its 
//   contributors may be used to endorse or promote products derived from this
//   software without specific prior written permission. 
// 
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
// THE POSSIBILITY OF SUCH DAMAGE.
// 

using System;
using System.Collections;
using System.Collections.Specialized;
using System.Text;
using System.Globalization;

using NLog;
using NLog.Targets;
using NLog.Filters;

namespace NLog.Config
{
    /// <summary>
    /// Represents a logging rule. An equivalent of &lt;logger /&gt; configuration element.
    /// </summary>
    public class LoggingRule
    {
        internal enum MatchMode
        {
            All, None, Equals, StartsWith, EndsWith, Contains, 
        } 

        private string _loggerNamePattern;
        private MatchMode _loggerNameMatchMode;
        private string _loggerNameMatchArgument;

        private bool[]_logLevels = new bool[LogLevel.MaxLevel.Ordinal + 1];
        private TargetCollection _targets = new TargetCollection();
        private FilterCollection _filters = new FilterCollection();
        private LoggingRuleCollection _childRules = new LoggingRuleCollection();
        private bool _final = false;

        /// <summary>
        /// Returns a string representation of <see cref="LoggingRule"/>. Used for debugging.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(CultureInfo.InvariantCulture, "logNamePattern: ({0}:{1})", _loggerNameMatchArgument, _loggerNameMatchMode);
            sb.Append(" levels: [ ");
            for (int i = 0; i < _logLevels.Length; ++i)
            {
                if (_logLevels[0])
                    sb.AppendFormat(CultureInfo.InvariantCulture, "{0} ", LogLevel.FromOrdinal(i).ToString());
            }
            sb.Append("] appendTo: [ ");
            foreach (Target app in _targets)
            {
                sb.AppendFormat(CultureInfo.InvariantCulture, "{0} ", app.Name);
            }
            sb.Append("]");
            return sb.ToString();
        }

        /// <summary>
        /// A collection of targets that should be written to when this rule matches.
        /// </summary>
        public TargetCollection Targets
        {
            get { return _targets; }
        }

        /// <summary>
        /// A collection of child rules to be evaluated when this rule matches.
        /// </summary>
        public LoggingRuleCollection ChildRules
        {
            get { return _childRules; }
        }

        /// <summary>
        /// A collection of filters to be checked before writing to targets.
        /// </summary>
        public FilterCollection Filters
        {
            get { return _filters; }
        }

        /// <summary>
        /// Quit processing any further rule when this one matches.
        /// </summary>
        public bool Final
        {
            get { return _final; }
            set { _final = value; }
        }

        /// <summary>
{'fraction_non_alphanumeric': 0.09127204169901297, 'fraction_numerical': 0.003327048907618942, 'mean_word_length': 2.210395158419366, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7366836', 'n_tokens_mistral': 2344, 'n_tokens_neox': 2189, 'n_words': 865}