Share via


LoggingImageGeneratorBuilderExtensions.UseLogging Method

Definition

Adds logging to the image generator pipeline.

public static Microsoft.Extensions.AI.ImageGeneratorBuilder UseLogging(this Microsoft.Extensions.AI.ImageGeneratorBuilder builder, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory = default, Action<Microsoft.Extensions.AI.LoggingImageGenerator>? configure = default);
static member UseLogging : Microsoft.Extensions.AI.ImageGeneratorBuilder * Microsoft.Extensions.Logging.ILoggerFactory * Action<Microsoft.Extensions.AI.LoggingImageGenerator> -> Microsoft.Extensions.AI.ImageGeneratorBuilder
<Extension()>
Public Function UseLogging (builder As ImageGeneratorBuilder, Optional loggerFactory As ILoggerFactory = Nothing, Optional configure As Action(Of LoggingImageGenerator) = Nothing) As ImageGeneratorBuilder

Parameters

loggerFactory
ILoggerFactory

An optional ILoggerFactory used to create a logger with which logging should be performed. If not supplied, a required instance will be resolved from the service provider.

configure
Action<LoggingImageGenerator>

An optional callback that can be used to configure the LoggingImageGenerator instance.

Returns

The builder.

Exceptions

builder is null.

Remarks

When the employed ILogger enables Trace, the contents of prompts and options are logged. These prompts and options may contain sensitive application data. Trace is disabled by default and should never be enabled in a production environment. Prompts and options are not logged at other logging levels.

Applies to