Reference

SetEffectLogLevel

Package Trax.EffectNamespace Trax.Effect.ExtensionsSource TraxEffectConfigurationBuilderExtensions.cs

Sets the level the logging effects write their entries at. The junction logger (AddJunctionLogger) and the JSON effect (AddJson) write every entry at this level; the host's logging configuration decides whether that level is kept.

Signature

public static class TraxEffectBuilderExtensions
{
    public static TBuilder SetEffectLogLevel<TBuilder>(
        this TBuilder builder,
        LogLevel logLevel
    )
        where TBuilder : TraxEffectBuilder;
}

Parameters

ParameterTypeDescription
logLevelLogLevelThe level the effects' entries are written at

Returns

TBuilder, the builder type it was called on.

Behavior

Sets the builder's LogLevel, which defaults to LogLevel.Debug and becomes ITraxEffectConfiguration.LogLevel. It is the level entries are written at, not a filter: LogLevel.Warning writes each junction's metadata, serialized output included, as a warning. The categories are the providers' type names, so the host's logging configuration can filter them. It does not affect AddDataContextLogging, which has its own minimum level.

Example

services.AddTrax(trax => trax
    .AddEffects(effects => effects
        .SetEffectLogLevel(LogLevel.Trace)
        .UsePostgres(connectionString)
        .AddJunctionLogger()
    )
    .AddMediator(typeof(IShipOrderTrain).Assembly)
);

See also