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

funcr: Prevent stack overflow on recursive structs #124

Merged
merged 2 commits into from
Dec 5, 2021

Conversation

thockin
Copy link
Contributor

@thockin thockin commented Dec 5, 2021

Add a new Option MaxLogDepth which tells funcr how many levels of nested fields (e.g. a struct that contains a struct that contains a struct, etc.) it may log. Every time it finds a struct, slice, array, or map the depth is increased by one. When the maximum is reached, the value will be converted to a string indicating that the max depth has been exceeded. If this field is not specified, a default value will be used.

Fixes #123

Add a new Option `MaxLogDepth` which  tells funcr how many levels of
nested fields (e.g. a struct that contains a struct that contains a
struct, etc.) it may log.  Every time it finds a struct, slice, array,
or map the depth is increased by one.  When the maximum is reached, the
value will be converted to a string indicating that the max depth has
been exceeded.  If this field is not specified, a default value will be
used.
@pohly pohly merged commit 99e02a9 into go-logr:master Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

funcr doesn't handle recursive pointers well
2 participants