Skip to content

Log step

A pipeline step for logging messages.

Author

Dimitrij Ray (dimitrij.ray@gdplabs.id)

References

NONE

LogStep(name, message, is_template=True, emit_kwargs=None, retry_config=None, cache_store=None, cache_config=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 enclosed in curly braces.

required
is_template bool

Whether the message contains placeholders. Defaults to True.

True
emit_kwargs dict[str, Any] | None

Additional 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
cache_store 'BaseCache' | None

Cache store to be used for caching. Defaults to None, in which case no cache store is used.

None
cache_config dict[str, Any] | None

Cache configuration to be used for caching. Defaults to None, in which case no cache configuration is used.

None

execute(state, runtime) 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[dict[str, Any] | BaseModel]

Runtime information for this step's execution.

required

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.