AddJunctionLogger
Adds per-junction execution logging as a junction-level effect. Writes each junction's metadata (name, duration, input/output types) to ILogger before and after the junction runs, at the effect log level. Nothing is written to the database.
Signature
public static TBuilder AddJunctionLogger<TBuilder>(
this TBuilder effectBuilder,
bool serializeJunctionData = false
)
where TBuilder : TraxEffectBuilderThe generic type parameter TBuilder is inferred by the compiler, so callers just write .AddJunctionLogger(). This preserves the concrete builder type through chaining (e.g., TraxEffectBuilderWithData stays as TraxEffectBuilderWithData).
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
serializeJunctionData | bool | No | false | Whether to serialize each junction's output. Adds detail but increases log volume and serialization work per junction. |
Returns
TBuilder, the same builder type that was passed in, for continued fluent chaining.
Example
services.AddTrax(trax => trax
.AddEffects(effects => effects
.UsePostgres(connectionString)
.AddJunctionLogger(serializeJunctionData: true)
)
);Remarks
- This is a junction-level effect (runs per junction, not per train).
- Junction metadata includes: junction name, start/end times, duration, input/output types.
- When
serializeJunctionDataistrue, each successful junction's output is serialized to JSON (junction input is not). Members marked[TraxSensitive]are written as{"_redacted": true}, and the copies a train is run from (a manifest'sProperties, a queued entry'sInput, a background job'sInput) as{"_omitted": true}. - The output is not serialized for a train whose output
SaveTrainParametersexcludes, is bounded byMaxParameterBytes(1 MiB by default) past which it is written as{"_truncated": true, "_maxBytes": N}, and is written as{"_unserializable": true, "_error": "<exception type>"}when it cannot be serialized. Serializing it never fails the train. See Junction Logger. - Registered as a toggleable effect.
Package
dotnet add package Trax.Effect.JunctionProvider.Logging