'Begin logging to the given set of observers.  This will:
1. Add all the observers given in C{observers} to the
L{LogPublisher} associated with this L{LogBeginner}.
2. Optionally re-direct standard output and standard error streams
to the logging system.
3. Re-play any messages that were previously logged to that
publisher to the new observers, if C{discardBuffer} is not set.
4. Stop logging critical errors from the L{LogPublisher} as strings
to the C{errorStream} associated with this L{LogBeginner}, and
allow them to be logged normally.
5. Re-direct warnings from the L{warnings} module associated with
this L{LogBeginner} to log messages.
@note: Since a L{LogBeginner} is designed to encapsulate the transition
between process-startup and log-system-configuration, this method
is intended to be invoked I{once}.
@param observers: The observers to register.
@type observers: iterable of L{ILogObserver}s
@param discardBuffer: Whether to discard the buffer and not re-play it
to the added observers.  (This argument is provided mainly for
compatibility with legacy concerns.)
@type discardBuffer: L{bool}
@param redirectStandardIO: If true, redirect standard output and
standard error to the observers.
@type redirectStandardIO: L{bool}'

def beginLoggingTo(self, observers, discardBuffer=False, redirectStandardIO=True):

    caller = currentframe(1)
    (filename, lineno) = (caller.f_code.co_filename, caller.f_lineno)
    for observer in observers:
        self._publisher.addObserver(observer)
    if (self._temporaryObserver is not None):
        self._publisher.removeObserver(self._temporaryObserver)
        if (not discardBuffer):
            self._initialBuffer.replayTo(self._publisher)
        self._temporaryObserver = None
        self._warningsModule.showwarning = self.showwarning
    else:
        (previousFile, previousLine) = self._previousBegin
        self._log.warn(MORE_THAN_ONCE_WARNING, fileNow=filename, lineNow=lineno, fileThen=previousFile, lineThen=previousLine)
    self._previousBegin = (filename, lineno)
    if redirectStandardIO:
        streams = [('stdout', LogLevel.info), ('stderr', LogLevel.error)]
    else:
        streams = []
    for (stream, level) in streams:
        oldStream = getattr(self._stdio, stream)
        loggingFile = LoggingFile(logger=Logger(namespace=stream, observer=self._publisher), level=level, encoding=getattr(oldStream, 'encoding', None))
        setattr(self._stdio, stream, loggingFile)
