jmcarp / nplusone

Auto-detecting the n+1 queries problem in Python
MIT License
993 stars 47 forks source link

Disable NPlusOneError exceptions when using Profiler? #26

Open adambyer opened 6 years ago

adambyer commented 6 years ago

Hi. Is there any way to disable the exceptions when using profile.Profiler(), and just get the logs?

hartwork commented 4 years ago

Not raising exceptions would not be hard:

class ForgivingProfiler(Profiler):
    """
    Fork of nplusone.core.profiler.Profiler
    that does not raise exceptions
    """
    def notify(self, message):
        pass  # or collect messages here

If NPLUSONE_RAISE should be respected out of the box, maybe Profiler would need to accept a config paramater. Would it make much difference, to have that built in?