Skip to main content

StreamedLogAsync

Streams Actor run log output to a Python logger in an asyncio task.

The log stream is consumed in a background asyncio task and each log message is forwarded to the provided logger with an appropriate log level inferred from the message content.

Can be used as an async context manager, which automatically starts and cancels the streaming task. Alternatively, call start and stop manually. Obtain an instance via RunClientAsync.get_streamed_log.

Hierarchy

Index

Methods

__aenter__

  • async __aenter__(): Self
  • Start the streaming task within the context. Exiting the context will cancel the streaming task.


    Returns Self

__aexit__

  • async __aexit__(exc_type, exc_val, exc_tb): None
  • Cancel the streaming task.


    Parameters

    • exc_type: type[BaseException] | None
    • exc_val: BaseException | None
    • exc_tb: TracebackType | None

    Returns None

__init__

  • __init__(log_client, *, to_logger, from_start): None
  • Initialize StreamedLogAsync.


    Parameters

    • log_client: LogClientAsync

      The async log client used to stream raw log data from the Actor run.

    • keyword-onlyto_logger: logging.Logger

      The logger to which the log messages will be forwarded.

    • optionalkeyword-onlyfrom_start: bool = True

      If True, all logs from the start of the Actor run will be streamed. If False, only newly arrived logs will be streamed. This can be useful for long-running Actors in stand-by mode where only recent logs are relevant.

    Returns None

start

  • Start the streaming task.

    The caller is responsible for cleanup by calling the stop method when done.


    Returns Task

stop

  • async stop(): None
  • Stop the streaming task.


    Returns None