#16288: Enabling 'django.request' logger when DEBUG is True
---------------------------------------+------------------------------
               Reporter:  mattbennett  |          Owner:  nobody
                   Type:  New feature  |         Status:  new
              Milestone:               |      Component:  Core (Other)
                Version:  SVN          |       Severity:  Normal
             Resolution:               |       Keywords:  logging
           Triage Stage:  Accepted     |      Has patch:  1
    Needs documentation:  0            |    Needs tests:  0
Patch needs improvement:  0            |  Easy pickings:  0
                  UI/UX:  0            |
---------------------------------------+------------------------------

Comment (by anonymous):

 A more general solution would be something like this:

 {{{
 class ConditionFilter(logging.Filter):
     def __init__(self, condition):
         self.condition = condition

     def filter(self, record):
         return self.condition
 }}}
 which you can then use in the logging configuration using something like
 {{{
 'require_debug_false': {
     '()': 'django.utils.log.ConditionFilter',
     'condition': not DEBUG,
 }
 }}}
 This will allow the filter to be used in more places, e.g. you could use a
 more complex settings-time condition.

 Regards,

 Vinay Sajip

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16288#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to