[telepathy-gabble/master] Make log-strip.py process its arguments
Will Thompson
will.thompson at collabora.co.uk
Tue Dec 8 04:19:38 PST 2009
---
tools/log-strip.py | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/tools/log-strip.py b/tools/log-strip.py
index c8e6dc5..3c8ca93 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()
--
1.5.6.5
More information about the telepathy-commits
mailing list