get_logs_subscriber(filter: Optional['LogFilter'] = None, reconnection_attempts: int = 10) -> 'PrefectLogsSubscriber'
Get a logs subscriber based on the current Prefect configuration.Similar to get_events_subscriber, this automatically detects whether
you’re using Prefect Cloud or OSS and returns the appropriate subscriber.
Subscribes to a Prefect logs stream, yielding logs as they occur.Example:from prefect.logging.clients import PrefectLogsSubscriber
from prefect.client.schemas.filters import LogFilter, LogFilterLevel
import loggingfilter = 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: