Skip to main content

prefect.logging.handlers

Functions

set_api_log_sink

emit_api_log

Classes

APILogWorker

Methods:

instance

max_batch_size

min_interval

APILogHandler

A logging handler that sends logs to the Prefect API. Sends log records to the APILogWorker which manages sending batches of logs in the background. Methods:

aflush

Tell the APILogWorker to send any currently enqueued logs and block until completion.

emit

Send a log to the APILogWorker

flush

Tell the APILogWorker to send any currently enqueued logs and block until completion. Use aflush from async contexts instead.

handleError

prepare

Convert a logging.LogRecord to the API LogCreate schema and serialize. This infers the linked flow or task run from the log record or the current run context. If a flow run id cannot be found, the log will be dropped. Logs exceeding the maximum size will be dropped.

WorkerAPILogHandler

Methods:

aflush

Tell the APILogWorker to send any currently enqueued logs and block until completion.

emit

emit

Send a log to the APILogWorker

flush

Tell the APILogWorker to send any currently enqueued logs and block until completion. Use aflush from async contexts instead.

handleError

prepare

Convert a logging.LogRecord to the API LogCreate schema and serialize. This will add in the worker id to the log. Logs exceeding the maximum size will be dropped.

prepare

Convert a logging.LogRecord to the API LogCreate schema and serialize. This infers the linked flow or task run from the log record or the current run context. If a flow run id cannot be found, the log will be dropped. Logs exceeding the maximum size will be dropped.

PrefectConsoleHandler

Methods:

emit