示例#1
0
        /// <summary>
        /// Add a rule for alle loglevels.
        /// </summary>
        /// <param name="target">Target to be written to when the rule matches.</param>
        /// <param name="loggerNamePattern">Logger name pattern. It may include the '*' wildcard at the beginning, at the end or at both ends.</param>
        public void AddRuleForAllLevels(Target target, string loggerNamePattern = "*")
        {
            var loggingRule = new LoggingRule(loggerNamePattern, target);

            loggingRule.EnableLoggingForLevels(LogLevel.MinLevel, LogLevel.MaxLevel);
            LoggingRules.Add(loggingRule);
        }
示例#2
0
        /// <summary>
        /// Add a rule for alle loglevels.
        /// </summary>
        /// <param name="target">Target to be written to when the rule matches.</param>
        /// <param name="loggerNamePattern">Logger name pattern. It may include the '*' wildcard at the beginning, at the end or at both ends.</param>
        public void AddRuleForAllLevels(Target target, string loggerNamePattern = "*")
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            var loggingRule = new LoggingRule(loggerNamePattern, target);

            loggingRule.EnableLoggingForLevels(LogLevel.MinLevel, LogLevel.MaxLevel);
            AddLoggingRulesThreadSafe(loggingRule);
        }