Skip to content

Commit eec65ec

Browse files
committed
Use skipEnabledCheck in Middleware
1 parent 7b00854 commit eec65ec

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/Middleware/HostFiltering/src/LoggerExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal static class LoggerExtensions
1212
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, "AllowedHosts"), "Allowed hosts: {Hosts}");
15+
LoggerMessage.Define<string>(LogLevel.Debug, new EventId(1, "AllowedHosts"), "Allowed hosts: {Hosts}", skipEnabledCheck: true);
1616

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

src/Middleware/Session/src/LoggingExtensions.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,22 @@ static LoggingExtensions()
3434
_sessionStarted = LoggerMessage.Define<string, string>(
3535
eventId: new EventId(3, "SessionStarted"),
3636
logLevel: LogLevel.Information,
37-
formatString: "Session started; Key:{sessionKey}, Id:{sessionId}");
37+
formatString: "Session started; Key:{sessionKey}, Id:{sessionId}",
38+
skipEnabledCheck: true);
3839
_sessionLoaded = LoggerMessage.Define<string, string, int>(
3940
eventId: new EventId(4, "SessionLoaded"),
4041
logLevel: LogLevel.Debug,
41-
formatString: "Session loaded; Key:{sessionKey}, Id:{sessionId}, Count:{count}");
42+
formatString: "Session loaded; Key:{sessionKey}, Id:{sessionId}, Count:{count}",
43+
skipEnabledCheck: true);
4244
_sessionStored = LoggerMessage.Define<string, string, int>(
4345
eventId: new EventId(5, "SessionStored"),
4446
logLevel: LogLevel.Debug,
4547
formatString: "Session stored; Key:{sessionKey}, Id:{sessionId}, Count:{count}");
4648
_sessionCacheReadException = LoggerMessage.Define<string>(
4749
eventId: new EventId(6, "SessionCacheReadException"),
4850
logLevel: LogLevel.Error,
49-
formatString: "Session cache read exception, Key:{sessionKey}");
51+
formatString: "Session cache read exception, Key:{sessionKey}",
52+
skipEnabledCheck: true);
5053
_errorUnprotectingCookie = LoggerMessage.Define(
5154
eventId: new EventId(7, "ErrorUnprotectingCookie"),
5255
logLevel: LogLevel.Warning,

0 commit comments

Comments
 (0)