'Add an event to the log.'

def add_event(self, event, frame=None):

    if (frame is None):
        frame = sys._getframe(1)
    try:
        frameno = self.frames.index(frame)
    except ValueError:
        frameno = len(self.frames)
        self.frames.append(frame)
    self.events.append((frameno, event, ident(frame)))
