[telepathy-gabble/master] add tool for stripping log files for comparison

Dafydd Harries dafydd.harries at collabora.co.uk
Tue Aug 11 06:48:06 PDT 2009


---
 tools/log-strip.py |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
 create mode 100644 tools/log-strip.py

diff --git a/tools/log-strip.py b/tools/log-strip.py
new file mode 100644
index 0000000..d7f0e68
--- /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()
+
-- 
1.5.6.5




More information about the telepathy-commits mailing list