Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update summary for default destructuring depth #1357

Merged
merged 2 commits into from Aug 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Serilog/Configuration/LoggerDestructuringConfiguration.cs
Expand Up @@ -137,9 +137,9 @@ public LoggerConfiguration ByTransforming<TValue>(Func<TValue, object> transform
}

/// <summary>
/// When destructuring objects, depth will be limited to 5 property traversals deep to
/// When destructuring objects, depth will be limited to 10 property traversals deep to
/// guard against ballooning space when recursive/cyclic structures are accidentally passed. To
/// increase this limit pass a higher value.
/// change this limit pass a new maximum depth.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

/// </summary>
/// <param name="maximumDestructuringDepth">The maximum depth to use.</param>
/// <returns>Configuration object allowing method chaining.</returns>
Expand Down
29 changes: 29 additions & 0 deletions test/Serilog.Tests/LoggerConfigurationTests.cs
Expand Up @@ -262,6 +262,35 @@ public void EnrichersExecuteInConfigurationOrder()
Assert.True(enrichedPropertySeen);
}

[Fact]
public void MaximumDestructuringDepthDefaultIsEffective()
{
var x = new
{
Lvl01 = new
{
Lvl02 = new
{
Lvl03 = new
{
Lvl04 = new
{
Lvl05 = new
{
Lvl06 = new { Lvl07 = new { Lvl08 = new { Lvl09 = new { Lvl10 = "Lvl11" } } } }
}
}
}
}
}
};

var xs = LogAndGetAsString(x, conf => conf, "@");

Assert.Contains("Lvl10", xs);
Assert.DoesNotContain("Lvl11", xs);
}

[Fact]
public void MaximumDestructuringDepthIsEffective()
{
Expand Down