[Zodb-checkins] CVS: ZODB3/Tools - parsezeolog.py:1.4

Jeremy Hylton jeremy@zope.com
Thu, 12 Dec 2002 16:34:37 -0500


Update of /cvs-repository/ZODB3/Tools
In directory cvs.zope.org:/tmp/cvs-serv11157

Modified Files:
	parsezeolog.py 
Log Message:
Give the report a header and some fixed-length fields.


=== ZODB3/Tools/parsezeolog.py 1.3 => 1.4 ===
--- ZODB3/Tools/parsezeolog.py:1.3	Thu Dec 12 16:27:33 2002
+++ ZODB3/Tools/parsezeolog.py	Thu Dec 12 16:34:37 2002
@@ -48,19 +48,24 @@
     def __init__(self):
         self.id = TStats.counter
         TStats.counter += 1
+
+    fields = ("time", "vote", "done", "user", "path")
+    fmt = "%-24s %5s %5s %-15s %s"
+    hdr = fmt % fields
     
     def report(self):
         """Print a report about the transaction"""
-        print time.ctime(self.begin),
+        t = time.ctime(self.begin)
         if hasattr(self, "vote"):
-            print self.vote - self.begin,
+            d_vote = self.vote - self.begin
         else:
-            print "*",
+            d_vote = "*"
         if hasattr(self, "finish"):
-            print self.finish - self.begin,
+            d_finish = self.finish - self.begin
         else:
-            print "*",
-        print self.user, self.url
+            d_finish =  "*"
+        print self.fmt % (time.ctime(self.begin), d_vote, d_finish,
+                          self.user, self.url)
 
 class TransactionParser:
 
@@ -124,5 +129,6 @@
             print "line", i
             raise
     print "Transaction: %d" % len(p.txns)
+    print TStats.hdr
     for txn in p.get_txns():
         txn.report()