'When invoked twice, L{LogBeginner.beginLoggingTo} will emit a log
message warning the user that they previously began logging, and add
the new log observers.'

def test_beginLoggingToTwice(self):

    events1 = []
    events2 = []
    fileHandle = io.StringIO()
    textObserver = textFileLogObserver(fileHandle)
    self.publisher(dict(event='prebuffer'))
    (firstFilename, firstLine) = nextLine()
    self.beginner.beginLoggingTo([events1.append, textObserver])
    self.publisher(dict(event='postbuffer'))
    (secondFilename, secondLine) = nextLine()
    self.beginner.beginLoggingTo([events2.append, textObserver])
    self.publisher(dict(event='postwarn'))
    warning = dict(log_format=MORE_THAN_ONCE_WARNING, log_level=LogLevel.warn, fileNow=secondFilename, lineNow=secondLine, fileThen=firstFilename, lineThen=firstLine)
    compareEvents(self, events1, [dict(event='prebuffer'), dict(event='postbuffer'), warning, dict(event='postwarn')])
    compareEvents(self, events2, [warning, dict(event='postwarn')])
    output = fileHandle.getvalue()
    self.assertIn('<{0}:{1}>'.format(firstFilename, firstLine), output)
    self.assertIn('<{0}:{1}>'.format(secondFilename, secondLine), output)
