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

Avoid logging when the max number of diffs has been reached #530

Closed
mbrulatout opened this issue Mar 19, 2025 · 1 comment
Closed

Avoid logging when the max number of diffs has been reached #530

mbrulatout opened this issue Mar 19, 2025 · 1 comment

Comments

@mbrulatout
Copy link

Hello,

We use Deepdiff to compare complex nested structures for a while now.
After investigating some CPU usage issue, we found out that there's a max_diffs option which sounds promising.

Our use-case is to trigger actions if there's a diff, whatever it is, so max_diffs = 1 is the way to go.
We notice though that we get spammed with this log

logger.warning(MAX_DIFFS_REACHED_MSG.format(self.max_diffs))

Would it be possible to have a way to avoid this from happening?
It could be either from :

  • max_diffs=1 where there's a clear intent of exiting early without real detailed info about what's been going on
  • a dedicated param (though it looks overkill)
  • raise an exception

I have to admit the exception sounds appealing. Indeed, this would some the need to look at the stats systematically to find out what happened since you get the same return value, if i'm not mistaken, from a deepdiff(max_diffs=1) whether there's a diff or not.

@mbrulatout
Copy link
Author

nevermind, my actual use of max_diffs was wrong.
max_diffs : Every time 2 individual items are compared a diff is counted.

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

No branches or pull requests

1 participant