StreamedLog
Hierarchy
- StreamedLogBase
- StreamedLog
Index
Methods
__enter__
Start the streaming thread within the context. Exiting the context will finish the streaming thread.
Returns Self
__exit__
Stop the streaming thread.
Parameters
exc_type: type[BaseException] | None
exc_val: BaseException | None
exc_tb: TracebackType | None
Returns None
__init__
Initialize
StreamedLog.Parameters
log_client: LogClient
The 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 thread.
The caller is responsible for cleanup by calling the
stopmethod when done.Returns Thread
stop
Signal the streaming thread to stop logging and wait for it to finish.
Returns None
Streams Actor run log output to a Python logger in a background thread.
The log stream is consumed in a background thread and each log message is forwarded to the provided logger with an appropriate log level inferred from the message content.
Can be used as a context manager, which automatically starts and stops the streaming thread. Alternatively, call
startandstopmanually. Obtain an instance viaRunClient.get_streamed_log.