Skip to main content

prefect.server.logs.stream

Log streaming for live log distribution via websockets.

Functions

subscribed

Subscribe to a stream of logs matching the given filter. Args:
  • filter: The log filter to apply

logs

Create a stream of logs matching the given filter. Args:
  • filter: The log filter to apply

log_matches_filter

Check if a log matches the given filter criteria. Args:
  • log: The log to check
  • filter: The filter to apply
Returns:
  • True if the log matches the filter, False otherwise

distributor

Create a message handler that distributes logs to subscribed clients.

start_distributor

Starts the distributor consumer as a global background task

stop_distributor

Stops the distributor consumer global background task

run_distributor

Runs the distributor consumer forever until it is cancelled

Classes

LogDistributor

Service for distributing logs to websocket subscribers Methods:

all_services

Get list of all service classes

enabled

enabled

Whether the service is enabled

enabled_services

Get list of enabled service classes

environment_variable_name

environment_variable_name

run_services

Run enabled services until cancelled.

running

A context manager that runs enabled services on entry and stops them on exit.

service_settings

service_settings

The Prefect setting that controls whether the service is enabled

start

start

Start running the service, which may run indefinitely

stop

stop

Stop the service