StreamedLogAsync
Hierarchy
- StreamedLogBase
- StreamedLogAsync
Index
Methods
__aenter__
Start the streaming task within the context. Exiting the context will cancel the streaming task.
Returns Self
__aexit__
Cancel the streaming task.
Parameters
exc_type: type[BaseException] | None
exc_val: BaseException | None
exc_tb: TracebackType | None
Returns None
__init__
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. IfFalse, 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
stopmethod when done.Returns Task
stop
Stop the streaming task.
Returns None
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
startandstopmanually. Obtain an instance viaRunClientAsync.get_streamed_log.