From 48940a3200faae1f8947f2ea5be0f85ac6379fb1 Mon Sep 17 00:00:00 2001 From: Richard Darst Date: Sat, 01 Aug 2009 00:38:26 +0000 Subject: First effort at realtime updating of log files - With this change, the .log.txt is updated after every said line, so that people can catch up to the meeting. - This is a general mechanism, but not the most efficient for this task: It re-opens the file after every line. This isn't ideal, but was easiest to integrate. There are other considerations, such as the fact that filenames can change during the meeting (#meetingname command) or file permissions change (#restrictlogs). I still need to work out how to deal with these issues... darcs-hash:20090801003826-82ea9-fddfe6f61bf11ccce94fd80f6f66f3ffbe5fc9f7.gz --- (limited to 'writers.py') diff --git a/writers.py b/writers.py index e40c037..c942b77 100644 --- a/writers.py +++ b/writers.py @@ -69,8 +69,9 @@ def replaceWRAP(item): class _BaseWriter(object): - def __init__(self, M): + def __init__(self, M, save_file=None, **kwargs): self.M = M + self.save_file = save_file def format(self, extension=None): """Override this method to implement the formatting. @@ -126,6 +127,9 @@ class TextLog(_BaseWriter): M = self.M """Write raw text logs.""" return "\n".join(M.lines) + def addline(self, line): + self.save_file(self.format()) + class HTMLlog(_BaseWriter): -- cgit v0.9.1