'For a MemoryHandler, flushing means just sending the buffered
records to the target, if there is one. Override if you want
different behaviour.
The record buffer is also cleared by this operation.'

def flush(self):

    self.acquire()
    try:
        if self.target:
            for record in self.buffer:
                self.target.handle(record)
            self.buffer = []
    finally:
        self.release()
