diff --git a/src/Shared/LayoutRenderers/AspNetRequestCookieLayoutRenderer.cs b/src/Shared/LayoutRenderers/AspNetRequestCookieLayoutRenderer.cs index 524040f91..d661da6a0 100644 --- a/src/Shared/LayoutRenderers/AspNetRequestCookieLayoutRenderer.cs +++ b/src/Shared/LayoutRenderers/AspNetRequestCookieLayoutRenderer.cs @@ -73,19 +73,19 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) var cookies = httpRequest.Cookies; if (cookies?.Count > 0) { - bool excludeKeys = (CookieNames == null || CookieNames.Count == 0) && Exclude?.Count > 0; - var cookieValues = GetCookieValues(cookies, excludeKeys); + bool checkForExclude = (CookieNames == null || CookieNames.Count == 0) && Exclude?.Count > 0; + var cookieValues = GetCookieValues(cookies, checkForExclude); SerializePairs(cookieValues, builder, logEvent); } } #if !ASP_NET_CORE - private IEnumerable> GetCookieValues(HttpCookieCollection cookies, bool excludeKeys) + private IEnumerable> GetCookieValues(HttpCookieCollection cookies, bool checkForExclude) { var cookieNames = CookieNames?.Count > 0 ? CookieNames : cookies.Keys.Cast().ToList(); foreach (var cookieName in cookieNames) { - if (excludeKeys && Exclude.Contains(cookieName)) + if (checkForExclude && Exclude.Contains(cookieName)) continue; var httpCookie = cookies[cookieName]; @@ -116,12 +116,12 @@ private IEnumerable> GetCookieValues(HttpCookieColl } } #else - private IEnumerable> GetCookieValues(IRequestCookieCollection cookies, bool excludeKeys) + private IEnumerable> GetCookieValues(IRequestCookieCollection cookies, bool checkForExclude) { var cookieNames = CookieNames?.Count > 0 ? CookieNames : cookies.Keys; foreach (var cookieName in cookieNames) { - if (excludeKeys && Exclude.Contains(cookieName)) + if (checkForExclude && Exclude.Contains(cookieName)) continue; if (!cookies.TryGetValue(cookieName, out var cookieValue))