summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2009-12-08 12:19:38 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2009-12-08 13:51:55 +0000
commit5aa88e73da42faf7529b80e3ee952e70f4d0318c (patch)
treec8ea351f7f8b3e6d483656d1484a1b8c3447a766 /tools
parent481c0f19df9165f88a80960602cda53bf5f2a076 (diff)
Make log-strip.py process its arguments
Diffstat (limited to 'tools')
-rwxr-xr-xtools/log-strip.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/log-strip.py b/tools/log-strip.py
index c8e6dc54e..3c8ca938f 100755
--- a/tools/log-strip.py
+++ b/tools/log-strip.py
@@ -4,6 +4,8 @@ Strip varying data (PIDs, pointer values) from Gabble logs to make them
easier to compare.
"""
+from __future__ import with_statement
+
import re
import sys
@@ -16,10 +18,18 @@ def sanitise(line):
re.sub("('?<[^ ]+ [^>]*id=)[\"'][^\"']+[\"']",
lambda m: m.group(1) + '"?????"', line))))))
-def main():
- for line in sys.stdin:
+def process(file):
+ for line in file:
print sanitise(line),
+def main():
+ if len(sys.argv) > 1:
+ for fn in sys.argv[1:]:
+ with open(fn) as f:
+ process(f)
+ else:
+ process(sys.stdin)
+
if __name__ == '__main__':
main()