prefect.logging.clients
Functions
http_to_ws
logs_out_socket_from_api_url
get_logs_subscriber
Classes
PrefectLogsSubscriber
Subscribes to a Prefect logs stream, yielding logs as they occur.
Abnormal disconnects are retried. Clean disconnects end iteration unless
reconnect_on_clean_close is enabled. The logs stream is live-only, so logs
emitted while disconnected may be omitted.
Example:
from prefect.logging.clients import PrefectLogsSubscriber
from prefect.client.schemas.filters import LogFilter, LogFilterLevel
import logging
filter = LogFilter(level=LogFilterLevel(ge_=logging.INFO))
async with PrefectLogsSubscriber(filter=filter) as subscriber:
async for log in subscriber:
print(log.timestamp, log.level, log.message)
Methods: