'Construct a L{LoggingFile} with a built-in observer.
@param kwargs: keyword arguments for the L{LoggingFile}.
@type kwargs: L{dict}
@return: a L{LoggingFile} with an observer that appends received
events into the file\'s C{events} attribute (a L{list}) and
event messages into the file\'s C{messages} attribute (a L{list}).
@rtype: L{LoggingFile}'

def observedFile(self, **kwargs):

    def observer(event):
        f.events.append(event)
        if ('log_io' in event):
            f.messages.append(event['log_io'])
    log = Logger(observer=observer)
    f = LoggingFile(logger=log, **kwargs)
    f.events = []
    f.messages = []
    return f
