Azure/diagnostics-eventflow

Microsoft Logging: Add AddEventFlow extension for ILoggerBuilder

Closed this issue · 3 comments

lnhzd commented

the built-in loggers (Console, Debug, etc) have already been updated from ILoggerFactory to ILoggerBuilder, can we do/add the same for eventflow please?

i.e.:
public static ILoggingBuilder AddEventFlow(
this ILoggingBuilder loggingBuilder,
DiagnosticPipeline pipeline)
{
var loggerInput = pipeline?.Inputs?.Where(i => i is LoggerInput).FirstOrDefault();
if (loggerInput != null)
{
loggingBuilder.AddProvider(new EventFlowLoggerProvider((LoggerInput)loggerInput, pipeline.HealthReporter));
}

        return loggingBuilder;
    }

Thanks.

lnhzd commented

this way we don't need to pass DiagnosticPipeline into Startup, logger can be configured in WebHostBuilder by calling:
.ConfigureLogging(builder => builder.AddEventFlow(this.pipeline))

@lnhzd Microsoft.Extensions.Logging input version 1.4.1 has been published on NuGet.org. Please give it a try and let us know how it works for you!

lnhzd commented

Thanks, installed the new version worked as expected!