prefect.logging.loggers
get_logger
prefect
logger. These loggers are intended for internal use within the
prefect
package.
See get_run_logger
for retrieving loggers for use within task or flow runs.
By default, only run-related loggers are connected to the APILogHandler
.
get_run_logger
prefect.task_runs
or prefect.flow_runs
.
Contextual data about the run will be attached to the log records.
These loggers are connected to the APILogHandler
by default to send log records to
the API.
Args:
context
: A specific context may be provided as an override. By default, the
context is inferred from global state and this should not be needed.**kwargs
: Additional keyword arguments will be attached to the log records in
addition to the run metadataMissingContextError
: If no context can be foundflow_run_logger
get_run_logger
instead.
task_run_logger
get_run_logger
instead.
If only the flow run context is available, it will be used for default values
of flow_run
and flow
.
get_worker_logger
disable_logger
disable_run_logger
prefect.flow_run
and prefect.task_run
and disables them
within the context manager. Upon exiting the context manager, both loggers
are returned to their original state.
print_as_log
print
to send printed messages to the Prefect run logger.
If no run is active, print
will behave as if it were not patched.
If print
sends data to a file other than sys.stdout
or sys.stderr
, it will
not be forwarded to the Prefect logger either.
patch_print
print
method to use print_as_log
PrefectLogAdapter
extra
fields set on the adapter would overshadow any provided on a
log-by-log basis.
See https://bugs.python.org/issue32732 — the Python team has declared that this is
not a bug in the LoggingAdapter and subclassing is the intended workaround.
Methods:
process
getChild
LogEavesdropper
text