-
Notifications
You must be signed in to change notification settings - Fork 21
Application insights logger lightup #31
Application insights logger lightup #31
Conversation
Tratcher
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly style feedback
| { | ||
| if (item is TraceTelemetry traceTelemetry) | ||
| { | ||
| HttpResponseWritingExtensions.WriteAsync(_response, traceTelemetry.Message + Environment.NewLine).GetAwaiter().GetResult(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_response.WriteAsync?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resharper (
| return builder => | ||
| { | ||
| var loggerFactory = builder.ApplicationServices.GetService<ILoggerFactory>(); | ||
| // We need to disable filter on logger, filtering would be done by LoggerFactory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filter => filtering?
| private static void ConfigureLogging(IConfigurationBuilder configurationBuilder) | ||
| { | ||
| // Skip adding default rules when debugger is attached | ||
| // we want to sent all events to VS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sent -> send
| { | ||
| return _defaultLoggingLevels.Select(pair => | ||
| { | ||
| var key = $"Logging:{ApplicationInsightsLoggerFactory}:LogLevel:{pair.Key}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you extract just this part of the string as a constant when it's not used elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly because it was just too long
| { | ||
| var loggerFactory = builder.ApplicationServices.GetService<ILoggerFactory>(); | ||
| // We need to disable filter on logger, filtering would be done by LoggerFactory | ||
| loggerFactory.AddApplicationInsights(builder.ApplicationServices, (s, level) => true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you use the simpler LogLevel.Trace overload?
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="$(AppInsightsVersion)" /> | ||
| <PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="$(AspNetCoreVersion)" /> | ||
| <PackageReference Include="Microsoft.Extensions.Logging" Version="$(AspNetCoreVersion)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort
| public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IServiceProvider serviceProvider) | ||
| { | ||
| loggerfactory.AddConsole(LogLevel.Debug); | ||
| loggerFactory.AddConsole(LogLevel.Debug); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to be a warning when I push aspnet/Logging#605
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
muratg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, but check with @BrennanConroy WRT to his logging changes.
Fixes: #26