summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDafydd Harries <dafydd.harries@collabora.co.uk>2009-08-11 14:48:06 +0100
committerDafydd Harries <dafydd.harries@collabora.co.uk>2009-08-11 14:48:06 +0100
commit6fa0233593ca61cea05726eaeecc8be19bc3b0ea (patch)
tree1d0fbb98726f2bffc932d2ab46a415843a1df8a4 /tools
parentd70a8b3a9c729035c48ec207073ec6540651ece3 (diff)
add tool for stripping log files for comparison
Diffstat (limited to 'tools')
-rw-r--r--tools/log-strip.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/log-strip.py b/tools/log-strip.py
new file mode 100644
index 000000000..d7f0e68c6
--- /dev/null
+++ b/tools/log-strip.py
@@ -0,0 +1,25 @@
+
+"""
+Strip varying data (PIDs, pointer values) from Gabble logs to make them
+easier to compare.
+"""
+
+import re
+import sys
+
+def sanitise(line):
+ return (
+ re.sub('^(\*\* )?\(telepathy-gabble:\d+\)', '',
+ re.sub('\x1b\[0m', '',
+ re.sub('^RECV \[\d+\]', 'RECV [???]',
+ re.sub('0x.......', '0x???????',
+ re.sub("('?<[^ ]+ [^>]*id=)[\"'][^\"']+[\"']",
+ lambda m: m.group(1) + '"?????"', line))))))
+
+def main():
+ for line in sys.stdin:
+ print sanitise(line),
+
+if __name__ == '__main__':
+ main()
+