Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Conversation

@pakrym
Copy link
Contributor

@pakrym pakrym commented Apr 27, 2017

Fixes: #26

@pakrym pakrym requested a review from JunTaoLuo April 27, 2017 17:47
Copy link
Member

@Tratcher Tratcher left a 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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_response.WriteAsync?

Copy link
Contributor Author

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
Copy link
Member

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
Copy link
Member

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}";
Copy link
Member

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?

Copy link
Contributor Author

@pakrym pakrym Apr 27, 2017

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);
Copy link
Member

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)" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sort

@pakrym pakrym requested a review from muratg April 27, 2017 20:48
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IServiceProvider serviceProvider)
{
loggerfactory.AddConsole(LogLevel.Debug);
loggerFactory.AddConsole(LogLevel.Debug);
Copy link
Member

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

Copy link

@muratg muratg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link

@muratg muratg left a 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.

@pakrym pakrym closed this Apr 28, 2017
@pakrym pakrym reopened this Apr 28, 2017
@pakrym pakrym merged commit dfd1da6 into rel/2.0.0-preview1 Apr 28, 2017
@natemcmaster natemcmaster deleted the pakrym/application-insights-logger branch June 26, 2017 16:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants