diff -r e7336e63acf6 -r 94d71156517b slotUI/logger.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slotUI/logger.py Sat Jun 22 18:21:13 2013 +0200 @@ -0,0 +1,40 @@ +class eventLogger: + def __init__(self, filename): + self.filename = filename + + def push(self, data): + """Pushes data to logfile CSV output: + struc: + unix timestamp + system clock + rennbezeichnung + slot + slotname (player) + runde + letzte rundenzeit + beste rundenzeit + laplimit + timelimit + """ + try: + fd = open(self.filename, 'a') + ok = True + except: + ok = False + if not ok: + fd = open(self.filename, 'w') + if ok: + fd.write("%s;%s;\"%s\";%s;\"%s\";%s;%s;%s;%s;%s\n" % ( + data[0], + data[1], + data[2], + data[3], + data[4], + data[5], + data[6], + data[7], + data[8], + data[9] + )) + fd.close() +