Skip to content

Commit 44e4493

Browse files
Kahbazianalogrelay
authored andcommitted
Remove nameof for log event name (#17807)
1 parent d6796bd commit 44e4493

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Middleware/HostFiltering/src/LoggerExtensions.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ namespace Microsoft.AspNetCore.HostFiltering
99
internal static class LoggerExtensions
1010
{
1111
private static readonly Action<ILogger, Exception> _wildcardDetected =
12-
LoggerMessage.Define(LogLevel.Debug, new EventId(0, nameof(WildcardDetected)), "Wildcard detected, all requests with hosts will be allowed.");
12+
LoggerMessage.Define(LogLevel.Debug, new EventId(0, "WildcardDetected"), "Wildcard detected, all requests with hosts will be allowed.");
1313

1414
private static readonly Action<ILogger, string, Exception> _allowedHosts =
15-
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(1, nameof(AllowedHosts)), "Allowed hosts: {Hosts}");
15+
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(1, "AllowedHosts"), "Allowed hosts: {Hosts}");
1616

1717
private static readonly Action<ILogger, Exception> _allHostsAllowed =
18-
LoggerMessage.Define(LogLevel.Trace, new EventId(2, nameof(AllHostsAllowed)), "All hosts are allowed.");
18+
LoggerMessage.Define(LogLevel.Trace, new EventId(2, "AllHostsAllowed"), "All hosts are allowed.");
1919

2020
private static readonly Action<ILogger, string, Exception> _requestRejectedMissingHost =
21-
LoggerMessage.Define<string>(LogLevel.Information, new EventId(3, nameof(RequestRejectedMissingHost)), "{Protocol} request rejected due to missing or empty host header.");
21+
LoggerMessage.Define<string>(LogLevel.Information, new EventId(3, "RequestRejectedMissingHost"), "{Protocol} request rejected due to missing or empty host header.");
2222

2323
private static readonly Action<ILogger, string, Exception> _requestAllowedMissingHost =
24-
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(4, nameof(RequestAllowedMissingHost)), "{Protocol} request allowed with missing or empty host header.");
24+
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(4, "RequestAllowedMissingHost"), "{Protocol} request allowed with missing or empty host header.");
2525

2626
private static readonly Action<ILogger, string, Exception> _allowedHostMatched =
27-
LoggerMessage.Define<string>(LogLevel.Trace, new EventId(5, nameof(AllowedHostMatched)), "The host '{Host}' matches an allowed host.");
27+
LoggerMessage.Define<string>(LogLevel.Trace, new EventId(5, "AllowedHostMatched"), "The host '{Host}' matches an allowed host.");
2828

2929
private static readonly Action<ILogger, string, Exception> _noAllowedHostMatched =
30-
LoggerMessage.Define<string>(LogLevel.Information, new EventId(6, nameof(NoAllowedHostMatched)), "The host '{Host}' does not match an allowed host.");
30+
LoggerMessage.Define<string>(LogLevel.Information, new EventId(6, "NoAllowedHostMatched"), "The host '{Host}' does not match an allowed host.");
3131

3232
public static void WildcardDetected(this ILogger logger) => _wildcardDetected(logger, null);
3333
public static void AllowedHosts(this ILogger logger, string allowedHosts) => _allowedHosts(logger, allowedHosts, null);

0 commit comments

Comments
 (0)