Example #1
0
        Do nothing.
        """


def discardLogs():
    """
    Discard messages logged via the global C{logfile} object.
    """
    global logfile
    logfile = NullFile()


# Prevent logfile from being erased on reload.  This only works in cpython.
if "logfile" not in globals():
    logfile = LoggingFile(
        logger=NewLogger(),
        level=NewLogLevel.info,
        encoding=getattr(sys.stdout, "encoding", None),
    )
    logerr = LoggingFile(
        logger=NewLogger(),
        level=NewLogLevel.error,
        encoding=getattr(sys.stderr, "encoding", None),
    )


class DefaultObserver(_GlobalStartStopObserver):
    """
    Default observer.

    Will ignore all non-error messages and send error messages to sys.stderr.
Example #2
0
        """
        Do nothing.
        """


def discardLogs():
    """
    Discard messages logged via the global C{logfile} object.
    """
    global logfile
    logfile = NullFile()


# Prevent logfile from being erased on reload.  This only works in cpython.
if 'logfile' not in globals():
    logfile = LoggingFile(logger=NewLogger(),
                          level=NewLogLevel.info,
                          encoding=getattr(sys.stdout, "encoding", None))
    logerr = LoggingFile(logger=NewLogger(),
                         level=NewLogLevel.error,
                         encoding=getattr(sys.stderr, "encoding", None))


class DefaultObserver(_GlobalStartStopMixIn):
    """
    Default observer.

    Will ignore all non-error messages and send error messages to sys.stderr.
    Will be removed when startLogging() is called for the first time.
    """
    stderr = sys.stderr