From 4640c5558280f97dc3f78c3092c8222ba7ffb008 Mon Sep 17 00:00:00 2001 From: DualFroz Date: Fri, 28 Aug 2026 13:24:33 +0200 Subject: [PATCH] docs: document default values for Filters properties in XML docs Continues the work started for #5917 (already covered Targets, Layouts, LayoutRenderers and Target Wrappers), extending the same pattern to the NLog.Filters namespace so default values show up in IntelliSense and the generated API docs. Adds a regression test that scans all settable NLog.Filters properties against the generated XML documentation file and fails if any of them is missing a documented default value. --- src/NLog/Filters/ConditionBasedFilter.cs | 1 + src/NLog/Filters/Filter.cs | 1 + src/NLog/Filters/LayoutBasedFilter.cs | 1 + src/NLog/Filters/WhenContainsFilter.cs | 2 ++ src/NLog/Filters/WhenEqualFilter.cs | 2 ++ src/NLog/Filters/WhenNotContainsFilter.cs | 2 ++ src/NLog/Filters/WhenNotEqualFilter.cs | 2 ++ src/NLog/Filters/WhenRepeatedFilter.cs | 8 ++++++++ 8 files changed, 19 insertions(+) diff --git a/src/NLog/Filters/ConditionBasedFilter.cs b/src/NLog/Filters/ConditionBasedFilter.cs index 1a04215..35eb3b9 100644 --- a/src/NLog/Filters/ConditionBasedFilter.cs +++ b/src/NLog/Filters/ConditionBasedFilter.cs @@ -50,6 +50,7 @@ namespace NLog.Filters /// /// Gets or sets the condition expression. /// + /// [Required] Default: /// public ConditionExpression Condition { get; set; } = ConditionLiteralExpression.Null; diff --git a/src/NLog/Filters/Filter.cs b/src/NLog/Filters/Filter.cs index 779f4b7..1a996f2 100644 --- a/src/NLog/Filters/Filter.cs +++ b/src/NLog/Filters/Filter.cs @@ -53,6 +53,7 @@ namespace NLog.Filters /// /// Gets or sets the action to be taken when filter matches. /// + /// Default: /// public FilterResult Action { get; set; } diff --git a/src/NLog/Filters/LayoutBasedFilter.cs b/src/NLog/Filters/LayoutBasedFilter.cs index bc047f5..a807788 100644 --- a/src/NLog/Filters/LayoutBasedFilter.cs +++ b/src/NLog/Filters/LayoutBasedFilter.cs @@ -51,6 +51,7 @@ namespace NLog.Filters /// Gets or sets the layout to be used to filter log messages. /// /// The layout. + /// [Required] Default: /// public Layout Layout { get; set; } = Layout.Empty; } diff --git a/src/NLog/Filters/WhenContainsFilter.cs b/src/NLog/Filters/WhenContainsFilter.cs index e5135c6..c014156 100644 --- a/src/NLog/Filters/WhenContainsFilter.cs +++ b/src/NLog/Filters/WhenContainsFilter.cs @@ -45,12 +45,14 @@ namespace NLog.Filters /// /// Gets or sets a value indicating whether to ignore case when comparing strings. /// + /// Default: /// public bool IgnoreCase { get; set; } /// /// Gets or sets the substring to be matched. /// + /// [Required] Default: /// public string Substring { get; set; } = string.Empty; diff --git a/src/NLog/Filters/WhenEqualFilter.cs b/src/NLog/Filters/WhenEqualFilter.cs index e8a66cb..45513a2 100644 --- a/src/NLog/Filters/WhenEqualFilter.cs +++ b/src/NLog/Filters/WhenEqualFilter.cs @@ -45,12 +45,14 @@ namespace NLog.Filters /// /// Gets or sets a value indicating whether to ignore case when comparing strings. /// + /// Default: /// public bool IgnoreCase { get; set; } /// /// Gets or sets a string to compare the layout to. /// + /// Default: /// public string CompareTo { get; set; } = string.Empty; diff --git a/src/NLog/Filters/WhenNotContainsFilter.cs b/src/NLog/Filters/WhenNotContainsFilter.cs index 53a4d54..52709f2 100644 --- a/src/NLog/Filters/WhenNotContainsFilter.cs +++ b/src/NLog/Filters/WhenNotContainsFilter.cs @@ -45,12 +45,14 @@ namespace NLog.Filters /// /// Gets or sets the substring to be matched. /// + /// [Required] Default: /// public string Substring { get; set; } = string.Empty; /// /// Gets or sets a value indicating whether to ignore case when comparing strings. /// + /// Default: /// public bool IgnoreCase { get; set; } diff --git a/src/NLog/Filters/WhenNotEqualFilter.cs b/src/NLog/Filters/WhenNotEqualFilter.cs index 3abd781..accd268 100644 --- a/src/NLog/Filters/WhenNotEqualFilter.cs +++ b/src/NLog/Filters/WhenNotEqualFilter.cs @@ -52,12 +52,14 @@ namespace NLog.Filters /// /// Gets or sets a string to compare the layout to. /// + /// Default: /// public string CompareTo { get; set; } = string.Empty; /// /// Gets or sets a value indicating whether to ignore case when comparing strings. /// + /// Default: /// public bool IgnoreCase { get; set; } diff --git a/src/NLog/Filters/WhenRepeatedFilter.cs b/src/NLog/Filters/WhenRepeatedFilter.cs index 3914c23..c27922f 100644 --- a/src/NLog/Filters/WhenRepeatedFilter.cs +++ b/src/NLog/Filters/WhenRepeatedFilter.cs @@ -54,12 +54,14 @@ namespace NLog.Filters /// /// How long before a filter expires, and logging is accepted again /// + /// Default: 10 /// public int TimeoutSeconds { get; set; } = 10; /// /// Max length of filter values, will truncate if above limit /// + /// Default: 1000 /// public int MaxLength { get; set; } = 1000; @@ -67,30 +69,35 @@ namespace NLog.Filters /// Applies the configured action to the initial logevent that starts the timeout period. /// Used to configure that it should ignore all events until timeout. /// + /// Default: /// public bool IncludeFirst { get; set; } /// /// Max number of unique filter values to expect simultaneously /// + /// Default: 50000 /// public int MaxFilterCacheSize { get; set; } = 50000; /// /// Default number of unique filter values to expect, will automatically increase if needed /// + /// Default: 1000 /// public int DefaultFilterCacheSize { get; set; } = 1000; /// /// Insert FilterCount value into when an event is no longer filtered /// + /// Default: /// public string FilterCountPropertyName { get; set; } = string.Empty; /// /// Append FilterCount to the when an event is no longer filtered /// + /// Default: /// public string FilterCountMessageAppendFormat { get; set; } = string.Empty; @@ -106,6 +113,7 @@ namespace NLog.Filters /// /// Default buffer size for the internal buffers /// + /// Default: 1000 /// public int OptimizeBufferDefaultLength { get; set; } = 1000;