<PackageReference Include="NLog" Version="6.2.2" />

NLog.Config.LoggingRule

public class LoggingRule
Represents a logging rule. An equivalent of <logger /> configuration element.
public IList<LoggingRule> ChildRules { get; }

Obsolete since too exotic feature with NLog v5.3. Gets a collection of child rules to be evaluated when this rule matches.

public FilterResult DefaultFilterResult { get; set; }

Obsolete and replaced by FilterDefaultAction with NLog v5. Default action when filters not matching

public FilterResult FilterDefaultAction { get; set; }

Default action if none of the filters match

public IList<Filter> Filters { get; }

Gets a collection of filters to be checked before writing to targets.

public bool Final { get; set; }

Gets or sets a value indicating whether to quit processing any following rules when this one matches.

public LogLevel FinalMinLevel { get; set; }

Gets or sets the LogLevel whether to quit processing any following rules when lower severity and this one matches.

Gets the collection of log levels enabled by this rule.

public string LoggerNamePattern { get; set; }

Gets or sets logger name pattern.

public LogLevel MinLevel { get; set; }

Gets or sets the minimum LogLevel needed to trigger this rule.

public string RuleName { get; set; }

Rule identifier to allow rule lookup

public IList<Target> Targets { get; }

Gets a collection of targets that should be written to when this rule matches.

public LoggingRule()

Create an empty LoggingRule.

public LoggingRule(string ruleName)

Create an empty LoggingRule.

public LoggingRule(string loggerNamePattern, LogLevel minLevel, LogLevel maxLevel, Target target)

Create a new LoggingRule with a minLevel and maxLevel which writes to target.

public LoggingRule(string loggerNamePattern, LogLevel minLevel, Target target)

Create a new LoggingRule with a minLevel which writes to target.

public LoggingRule(string loggerNamePattern, Target target)

Create a (disabled) LoggingRule. You should call EnableLoggingForLevel or EnableLoggingForLevels to enable logging.

public void DisableLoggingForLevel(LogLevel level)

Disables logging for a particular level.

public void DisableLoggingForLevels(LogLevel minLevel, LogLevel maxLevel)

Disables logging for particular levels between (included) minLevel and maxLevel.

public void EnableLoggingForLevel(LogLevel level)

Enables logging for a particular level.

public void EnableLoggingForLevels(LogLevel minLevel, LogLevel maxLevel)

Enables logging for a particular levels between (included) minLevel and maxLevel.

Checks whether the particular log level is enabled for this rule.

public bool NameMatches(string loggerName)

Checks whether given name matches the LoggerNamePattern.

public void SetLoggingLevels(LogLevel minLevel, LogLevel maxLevel)

Enables logging the levels between (included) minLevel and maxLevel. All the other levels will be disabled.

public void WriteTo(Target[] targets)

Updates Targets for output by replacing with the input targets collection.

public void WriteTo(IEnumerable<Target> targets)

Updates Targets for output by replacing with the input targets collection