On Mon, 2009-08-03 at 15:48 +0400, Ivan Sagalaev wrote: > Hello! > > A couple of days ago a sudden thought has struck me while thinking on > the matter of logging in Python libraries. I consider a good practice > for a library to log what it's doing into a named logger without setting > up logging by itself. It's then a responsibility of an application that > would use the library so set up logging as it see fit.
Adrian, in particular, has been historically against adding logger module hooks in Django. So you have to work around that. > > In this vein I propose to teach CursorDebugWrapper to log SQL queries > into a named logger instead of storing them into connection.queries. > Before writing a patch I want to discuss it. [... snip discussion of how Python's logger module works...] I have a patch I've been holding over for 1.2 that reduces the current debug wrapper's log method to a ring buffer to avoid the accidental massive memory usage case. The number of entries in that ring buffer is configurable. Adding a hook to make it use a logger instead is about three lines of code, I suspect (and one or two lines for people who want to use it that way). I'll send you what I have later on today, Ivan, and you can have a look. Then we can polish it and see if it looks appropriate for 1.2. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---
