[CalendarServer-changes] [7319] CalendarServer/trunk/contrib/performance/loadtest/ical.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 15 08:59:27 PDT 2011


Revision: 7319
          http://trac.macosforge.org/projects/calendarserver/changeset/7319
Author:   exarkun at twistedmatrix.com
Date:     2011-04-15 08:59:26 -0700 (Fri, 15 Apr 2011)
Log Message:
-----------
Add success/failure indication to request logger

Modified Paths:
--------------
    CalendarServer/trunk/contrib/performance/loadtest/ical.py

Modified: CalendarServer/trunk/contrib/performance/loadtest/ical.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/ical.py	2011-04-14 21:16:37 UTC (rev 7318)
+++ CalendarServer/trunk/contrib/performance/loadtest/ical.py	2011-04-15 15:59:26 UTC (rev 7319)
@@ -670,10 +670,13 @@
 
 
 class RequestLogger(object):
-    format = "%(user)s request %(code)s %(lag)s[%(duration)0.2f ms] %(method)8s %(url)s"
-    lagFormat = '{Lag %0.2f ms} '
-    lagSpacer = ' ' * len(lagFormat % (1.0,))
+    format = u"%(user)s request %(code)s%(success)s%(lag)s[%(duration)0.2f ms] %(method)8s %(url)s"
+    lagFormat = u'{Lag %0.2f ms} '
+    lagSpacer = u' ' * len(lagFormat % (1.0,))
 
+    success = u"\N{CHECK MARK}"
+    failure = u"\N{BALLOT X}"
+
     def observe(self, event):
         if event.get("type") == "response":
             event['url'] = urlunparse(('', '') + urlparse(event['url'])[2:])
@@ -681,7 +684,11 @@
                 event['lag'] = self.lagSpacer
             else:
                 event['lag'] = self.lagFormat % (event['lag'] * 1000.0,)
-            print self.format % event
+            if event['success']:
+                event['success'] = self.success
+            else:
+                event['success'] = self.failure
+            print (self.format % event).encode('utf-8')
 
 
     def report(self):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110415/a021c040/attachment.html>


More information about the calendarserver-changes mailing list