Table of Contents

Class EngineLogScope

Namespace
FlowOrchestrator.Core.Observability
Assembly
FlowOrchestrator.Core.dll

Helper for opening an BeginScope<TState>(TState) populated with the engine's standard correlation properties (RunId, FlowId, StepKey, Attempt).

public static class EngineLogScope
Inheritance
EngineLogScope
Inherited Members

Remarks

Every public engine entry point should wrap its body in using var _ = EngineLogScope.Begin(...) so every nested log line — including logs emitted by user-written step handlers — automatically carries the run-level correlation. Logging providers that honour scopes (Serilog, NLog, OpenTelemetry Logs, Application Insights) surface these as searchable properties.

Methods

Begin(ILogger?, Guid, Guid, string?, int?)

Begins a logger scope tagged with the run-level correlation IDs.

public static IDisposable? Begin(ILogger? logger, Guid runId, Guid flowId, string? stepKey = null, int? attempt = null)

Parameters

logger ILogger

The logger to attach the scope to. Returns null when null.

runId Guid

The current run identifier.

flowId Guid

The flow identifier owning the run.

stepKey string

Optional step key — set when scoped to a single step's execution.

attempt int?

Optional attempt number — set on retry execution paths.

Returns

IDisposable

An IDisposable that closes the scope, or null if the logger is null.