Skip to content

Commit

Permalink
Remove unused method LoadXmlLoggingConfigurationFromPath (#1068)
Browse files Browse the repository at this point in the history
  • Loading branch information
snakefoot authored Nov 22, 2024
1 parent 9d837e5 commit 5756772
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
7 changes: 0 additions & 7 deletions src/NLog.Web.AspNetCore/AspNetExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -446,13 +446,6 @@ private static string ResolveEnvironmentNLogConfigFile(string basePath, string e
return null;
}

private static LoggingConfiguration LoadXmlLoggingConfigurationFromPath(string contentRootPath, string nlogConfigFileName, LogFactory logFactory)
{
var standardPath = System.IO.Path.Combine(contentRootPath, nlogConfigFileName);
return System.IO.File.Exists(standardPath) ?
new XmlLoggingConfiguration(standardPath, logFactory) : null;
}

private static bool IsLoggingConfigurationLoaded(LoggingConfiguration cfg)
{
return cfg?.LoggingRules?.Count > 0 && cfg?.AllTargets?.Count > 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent)
var response = HttpContextAccessor.HttpContext.TryGetResponse();
#if ASP_NET_CORE
builder.Append(response?.HasStarted == true ? '1' : '0');
#elif NET46
#elif NET46_OR_GREATER
builder.Append(response?.HeadersWritten == true ? '1' : '0');
#endif
}
Expand Down
11 changes: 6 additions & 5 deletions src/Shared/LayoutRenderers/AspNetUserClaimLayoutRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent)
}
}

#if NET46
#if !ASP_NET_CORE
private static IEnumerable<KeyValuePair<string, string>> GetAllClaims(System.Security.Principal.IPrincipal claimsPrincipal)
{
return GetAllClaims(claimsPrincipal as ClaimsPrincipal);
Expand All @@ -91,16 +91,17 @@ private static IEnumerable<KeyValuePair<string, string>> GetAllClaims(ClaimsPrin
new KeyValuePair<string, string>(claim.Type, claim.Value)) ??
System.Linq.Enumerable.Empty<KeyValuePair<string, string>>();
}
#if NET46
private static Claim GetClaim(System.Security.Principal.IPrincipal claimsPrincipal, string claimType)
#else

#if ASP_NET_CORE
private static Claim GetClaim(ClaimsPrincipal claimsPrincipal, string claimType)
#else
private static Claim GetClaim(System.Security.Principal.IPrincipal claimsPrincipal, string claimType)
#endif
{
var claimsIdentity = claimsPrincipal.Identity as ClaimsIdentity; // Prioritize primary identity
return claimsIdentity?.FindFirst(claimType)
#if ASP_NET_CORE
?? claimsPrincipal.FindFirst(claimType)
?? claimsPrincipal.FindFirst(claimType)
#endif
;
}
Expand Down

0 comments on commit 5756772

Please sign in to comment.