microsoft / ApplicationInsights-dotnet-logging

.NET Logging adaptors
106 stars 49 forks source link

[WIP] moved ILogger as is #221

Closed SergeyKanzhelev closed 5 years ago

SergeyKanzhelev commented 6 years ago

This PR is to collect the feedback

CC: @davidfowl

davidfowl commented 6 years ago

@pakrym Can you a review here? I have some changes locally that re-baselines on .NET Standard 2.0 and the 2.0 version of logging. Where I'm currently stuck is trying to figure out how to implement AddApplicationInsights on ILoggerBuilder. We need a bunch of services here and I was messing with this:

public static ILoggingBuilder AddApplicationInsights(this ILoggingBuilder builder)
{
    builder.Services.TryAddSingleton<TelemetryClient>();
    builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, ApplicationInsightsLoggerProvider>());
    return builder;
}

This needs to compose with the method in the ASP.NET Core SDK so that things work if you call AddApplicationInsights directly or UseApplicationInsights on the IWebHostBuilder.