Skip to content

Commit e6cc4ae

Browse files
authored
Remove redundant static ctor from LoggerFactory (#48478)
1 parent 040ffb5 commit e6cc4ae

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/libraries/Microsoft.Extensions.Logging/src/LoggerFactory.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ namespace Microsoft.Extensions.Logging
1313
/// </summary>
1414
public class LoggerFactory : ILoggerFactory
1515
{
16-
private static readonly LoggerRuleSelector RuleSelector = new LoggerRuleSelector();
17-
1816
private readonly Dictionary<string, Logger> _loggers = new Dictionary<string, Logger>(StringComparer.Ordinal);
1917
private readonly List<ProviderRegistration> _providerRegistrations = new List<ProviderRegistration>();
2018
private readonly object _sync = new object();
@@ -212,7 +210,7 @@ private LoggerInformation[] CreateLoggers(string categoryName)
212210

213211
foreach (LoggerInformation loggerInformation in loggers)
214212
{
215-
RuleSelector.Select(_filterOptions,
213+
LoggerRuleSelector.Select(_filterOptions,
216214
loggerInformation.ProviderType,
217215
loggerInformation.Category,
218216
out LogLevel? minLevel,

src/libraries/Microsoft.Extensions.Logging/src/LoggerRuleSelector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
namespace Microsoft.Extensions.Logging
77
{
8-
internal class LoggerRuleSelector
8+
internal static class LoggerRuleSelector
99
{
10-
public void Select(LoggerFilterOptions options, Type providerType, string category, out LogLevel? minLevel, out Func<string, string, LogLevel, bool> filter)
10+
public static void Select(LoggerFilterOptions options, Type providerType, string category, out LogLevel? minLevel, out Func<string, string, LogLevel, bool> filter)
1111
{
1212
filter = null;
1313
minLevel = options.MinLevel;

0 commit comments

Comments
 (0)