1. Stefano Rivera
  2. dogslow-raven

Commits

Stefano Rivera  committed 5b250a5

Make dropping log files optional

  • Participants
  • Parent commits 945673c
  • Branches default

Comments (0)

Files changed (1)

File dogslow/__init__.py

View file
             output = output.encode('utf-8')
 
             # dump to file:
-            fd, fn = tempfile.mkstemp(prefix='slow_request_', suffix='.log',
-                                      dir=getattr(settings, 'DOGSLOW_OUTPUT',
-                                              tempfile.gettempdir()))
-            try:
-                os.write(fd, output)
-            finally:
-                os.close(fd)
+            write_log = getattr(settings, 'DOGSLOW_WRITE_LOG', True)
+            if write_log:
+                fd, fn = tempfile.mkstemp(prefix='slow_request_',
+                                          suffix='.log',
+                                          dir=getattr(settings,
+                                                      'DOGSLOW_OUTPUT',
+                                                      tempfile.gettempdir()))
+                try:
+                    os.write(fd, output)
+                finally:
+                    os.close(fd)
 
             # and email?
             email_to = getattr(settings, 'DOGSLOW_EMAIL_TO', None)