Commits

Erik van Zijst  committed 798429c Merge
  • Participants
  • Parent commits 3d44e8c, bbd4d1c

Comments (0)

Files changed (1)

File dogslow/__init__.py

 from django.conf import settings
 from django.core.exceptions import MiddlewareNotUsed
 from django.core.mail.message import EmailMessage
+from django.core.urlresolvers import resolve
+
 from dogslow.timer import Timer
 
+IGNORE_URLS = ignore_urls = getattr(settings, 'DOGSLOW_IGNORE_URLS', ())
+
 class SafePrettyPrinter(pprint.PrettyPrinter, object):
     def format(self, obj, context, maxlevels, level):
         try:
     def peek(request, thread_id, started):
         try:
             frame = sys._current_frames()[thread_id]
-
+            
+            match = resolve(request.META.get('PATH_INFO'))
+            if match.url_name in IGNORE_URLS:
+                return
+            
             req_string = '%s %s://%s%s' % (
                 request.META.get('REQUEST_METHOD'),
                 request.META.get('wsgi.url_scheme', 'http'),
 
             if hasattr(settings, 'DOGSLOW_LOGGER'):
                 logger = logging.getLogger(getattr(settings, 'DOGSLOW_LOGGER'))
-                logger.warn('Slow Request Watchdog: %s - %s', str(req_string), output)
+                logger.warn('Slow Request Watchdog: %s, %%s - %%s' % resolve(request.META.get('PATH_INFO')).url_name, str(req_string), output)
 
         except Exception:
             logging.exception('Request watchdog failed')