Skip to content

Commit 8e76d03

Browse files
committed
Use new C# 9.0 feature where appropriate
1 parent e6655c2 commit 8e76d03

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Log4NetTextFormatterOptionsBuilder.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class Log4NetTextFormatterOptionsBuilder
2727
/// <para>The default value has prefix <c>log4net</c> and namespace <c>http://logging.apache.org/log4net/schemas/log4net-events-1.2/</c>.</para>
2828
/// </summary>
2929
/// <remarks>https://github.com/apache/logging-log4net/blob/rel/2.0.8/src/Layout/XmlLayout.cs#L49</remarks>
30-
public XmlQualifiedName? Log4NetXmlNamespace { get; private set; } = new XmlQualifiedName("log4net", "http://logging.apache.org/log4net/schemas/log4net-events-1.2/");
30+
public XmlQualifiedName? Log4NetXmlNamespace { get; private set; } = new("log4net", "http://logging.apache.org/log4net/schemas/log4net-events-1.2/");
3131

3232
/// <summary>
3333
/// The line ending used for log4net events.
@@ -39,14 +39,14 @@ public class Log4NetTextFormatterOptionsBuilder
3939
/// The indentation settings used for log4net events. No indentation is used if <see langref="null"/>.
4040
/// <para>The default value uses two spaces.</para>
4141
/// </summary>
42-
public IndentationSettings? IndentationSettings { get; private set; } = new IndentationSettings(Indentation.Space, size: 2);
42+
public IndentationSettings? IndentationSettings { get; private set; } = new(Indentation.Space, size: 2);
4343

4444
/// <summary>
4545
/// The <see cref="PropertyFilter"/> applied on all Serilog properties.
4646
/// <para>The default implementation always returns <c>true</c>, i.e. it doesn't filter out any property.</para>
4747
/// </summary>
4848
/// <remarks>If an exception is thrown while executing the filter, the default filter will be applied, i.e. the Serilog property will be included in the log4net properties.</remarks>
49-
public PropertyFilter FilterProperty { get; private set; } = (logEvent, propertyName) => true;
49+
public PropertyFilter FilterProperty { get; private set; } = (_, _) => true;
5050

5151
/// <summary>
5252
/// The <see cref="ExceptionFormatter"/> controlling how all exceptions are formatted.
@@ -177,11 +177,11 @@ public void UseLog4JCompatibility()
177177
}
178178

179179
internal Log4NetTextFormatterOptions Build()
180-
=> new Log4NetTextFormatterOptions(FormatProvider, CDataMode, Log4NetXmlNamespace, CreateXmlWriterSettings(LineEnding, IndentationSettings), FilterProperty, FormatException);
180+
=> new(FormatProvider, CDataMode, Log4NetXmlNamespace, CreateXmlWriterSettings(LineEnding, IndentationSettings), FilterProperty, FormatException);
181181

182182
private static XmlWriterSettings CreateXmlWriterSettings(LineEnding lineEnding, IndentationSettings? indentationSettings)
183183
{
184-
return new XmlWriterSettings
184+
return new()
185185
{
186186
Indent = !(indentationSettings is null),
187187
IndentChars = indentationSettings?.ToString() ?? "",

0 commit comments

Comments
 (0)