This may be out of scope for this review as the functionality is already in the codebase but I think it is worth mentioning nonetheless as the implementation here seems a bit crude.

1. I do not think more than 5 queries is necessarily a warning condition.
2. There is no way of of disabling this logging. This may result in many log messages. 

I get the purpose of this, but if we are to keep it in the current state I suggest that we at least move it to the [ding_devel module](https://github.com/ding2/ding_devel/).