Skip to content

Log step

A pipeline step for logging messages.

LogStep(name, message, is_template=True, emit_kwargs=None, retry_config=None, error_handler=None, cache=None)

Bases: BasePipelineStep

A specialized pipeline step for logging messages.

This step uses the Messenger component to log messages during pipeline execution. It supports both plain text messages and template messages with placeholders for state variables.

Attributes:

Name Type Description
name str

A unique identifier for this pipeline step.

messenger Messenger

The messenger component used to format and send messages.

emit_kwargs dict[str, Any]

Additional arguments to pass to the event emitter.

retry_policy RetryPolicy | None

Configuration for retry behavior using LangGraph's RetryPolicy.

Initializes a new LogStep.

Parameters:

Name Type Description Default
name str

A unique identifier for this pipeline step.

required
message str

The message to be logged. May contain placeholders in curly braces for state variables.

required
is_template bool

Whether the message is a template with placeholders. Defaults to True.

True
emit_kwargs dict[str, Any] | None

Additional keyword arguments to pass to the event emitter. Defaults to None.

None
retry_config RetryConfig | None

Configuration for retry behavior using GLLM Core's RetryConfig. Defaults to None, in which case no retry config is applied.

None
error_handler BaseStepErrorHandler | None

Strategy to handle errors during execution. Defaults to None, in which case the RaiseStepErrorHandler is used.

None
cache CacheConfig | None

Configuration for the cache store including the cache store instance and its settings. Defaults to None, in which case no caching will be used.

None

execute(state, runtime, config=None) async

Executes the log step by formatting and emitting the message.

Parameters:

Name Type Description Default
state PipelineState

The current state of the pipeline, containing all data.

required
runtime Runtime

Runtime information for this step's execution.

required
config RunnableConfig | None

The runnable configuration. Defaults to None.

None

Returns:

Name Type Description
None None

This step does not modify the pipeline state.

Raises:

Type Description
RuntimeError

If an error occurs during message emission.