Skip to content

Commit

Permalink
Load NLog config from appsettings.json using ExtensionLoggingConfigur…
Browse files Browse the repository at this point in the history
…ation (code review)
  • Loading branch information
snakefoot committed Mar 27, 2019
1 parent 05213af commit f40a87f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ public IEnumerable<ILoggingConfigurationElement> Children
var children = _configurationSection.GetChildren();
foreach (var child in children)
{
if (child.GetChildren().Any())
var firstChildValue = child?.GetChildren()?.FirstOrDefault();
if (firstChildValue != null)
{
if (_nameOverride == "target" && string.Equals(child.Key, "target", StringComparison.OrdinalIgnoreCase) && child.GetChildren().Count() == 1)
{
yield return new LoggingConfigurationElement(child.GetChildren().First(), false, "target");
yield return new LoggingConfigurationElement(firstChildValue, false, "target");
}
else
{
Expand Down

0 comments on commit f40a87f

Please sign in to comment.