Changeset 10:8c11483aa2f3 in livinglogic.python.tipimaid

Show
Ignore:
Timestamp:
11/19/08 17:45:22 (10 years ago)
Author:
Nikolas Tautenhahn <nik@…>
Branch:
default
Message:

better sorting (if time is equal, later entries come after earlier ones)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • liaalh.py

    r9 r10  
    55import sys, os, datetime, errno, bisect, re, gzip 
    66 
     7 
     8class LogLine(tuple): 
     9    def __lt__(self, x): 
     10        return self[0] < x[0] 
    711 
    812class Buffer(object): 
     
    8084            utctime = self.apachedate2utc(datestring) 
    8185            (server, data) = line.split(None, 1) 
    82             self.add((utctime, server, data)) 
     86            self.add(LogLine((utctime, server, data))) 
    8387 
    8488 
     
    98102        sys.stderr.flush() 
    99103        return 1 
    100     buf = Buffer(pattern=args[0], gzip_logs=options.gzip) 
     104    buf = Buffer(pattern=args[0], gzip_logs=options.gzip, buffertime=300) 
    101105    buf.run() 
    102106