Commit fd0704e8 authored by Jeremy Hylton's avatar Jeremy Hylton

Give the report a header and some fixed-length fields.

parent b92b4a8f
...@@ -49,18 +49,23 @@ class TStats: ...@@ -49,18 +49,23 @@ class TStats:
self.id = TStats.counter self.id = TStats.counter
TStats.counter += 1 TStats.counter += 1
fields = ("time", "vote", "done", "user", "path")
fmt = "%-24s %5s %5s %-15s %s"
hdr = fmt % fields
def report(self): def report(self):
"""Print a report about the transaction""" """Print a report about the transaction"""
print time.ctime(self.begin), t = time.ctime(self.begin)
if hasattr(self, "vote"): if hasattr(self, "vote"):
print self.vote - self.begin, d_vote = self.vote - self.begin
else: else:
print "*", d_vote = "*"
if hasattr(self, "finish"): if hasattr(self, "finish"):
print self.finish - self.begin, d_finish = self.finish - self.begin
else: else:
print "*", d_finish = "*"
print self.user, self.url print self.fmt % (time.ctime(self.begin), d_vote, d_finish,
self.user, self.url)
class TransactionParser: class TransactionParser:
...@@ -124,5 +129,6 @@ if __name__ == "__main__": ...@@ -124,5 +129,6 @@ if __name__ == "__main__":
print "line", i print "line", i
raise raise
print "Transaction: %d" % len(p.txns) print "Transaction: %d" % len(p.txns)
print TStats.hdr
for txn in p.get_txns(): for txn in p.get_txns():
txn.report() txn.report()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment