twisted.logger.LoggingFile

Here are the examples of the python api twisted.logger.LoggingFile taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

3 Source : _base.py
with Apache License 2.0
from matrix-org

def redirect_stdio_to_logs() -> None:
    streams = [("stdout", LogLevel.info), ("stderr", LogLevel.error)]

    for (stream, level) in streams:
        oldStream = getattr(sys, stream)
        loggingFile = LoggingFile(
            logger=twisted.logger.Logger(namespace=stream),
            level=level,
            encoding=getattr(oldStream, "encoding", None),
        )
        setattr(sys, stream, loggingFile)

    print("Redirected stdout/stderr to logs")


def register_start(cb: Callable[..., Awaitable], *args: Any, **kwargs: Any) -> None: