changeset 440:5c62ebf2dd47

python/stripirssi.py
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 09 Aug 2013 14:21:49 -0700
parents a00edb8cf3d7
children f81fdc6926fd
files python/stripirssi.py
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/python/stripirssi.py	Fri Aug 09 11:27:36 2013 -0700
+++ b/python/stripirssi.py	Fri Aug 09 14:21:49 2013 -0700
@@ -40,12 +40,12 @@
         if not line:
             continue # XXX desirable?
         prefix, rest = line.split(separator, 1)
-        if length is not None:
+        if length is None:
             length = len(prefix)
         else:
             if len(prefix) != length:
                 if not line[:len(prefix)].isspace():
-                    raise AssertionError # XXX
+                    raise AssertionError("Non whitespace found below pre (%s) in line %s" % (length, line))
         stripped.append(line[length:])
     return stripped
 
@@ -76,7 +76,7 @@
                 if last:
                     last = '%s %s' % (last, line.strip())
                 else:
-                    joined.append(line.strip()
+                    joined.append(line.strip())
             else:
                 if last:
                     joined.append(last)
@@ -98,5 +98,12 @@
     #    parser.add_option - strip nicks
     options, args = parser.parse_args(args)
 
+    log = sys.stdin.read().strip()
+
+    # strip timestamps
+    lines = strip_first_column(log)
+
+    print '\n'.join(lines)
+    
 if __name__ == '__main__':
     main()