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

Add DisableColors option (#764) - #772

Merged
pakrym merged 7 commits into
aspnet:devfrom
bruce-lindsay:issue-764
Apr 4, 2018
Merged

pakrym merged 7 commits into
aspnet:devfrom
bruce-lindsay:issue-764

Conversation

@bruce-lindsay

Copy link
Copy Markdown
Contributor

No description provided.

@dnfclas

dnfclas commented Mar 3, 2018 •

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

@davidfowl

Copy link
Copy Markdown
Member

@bruce-lindsay the code doesn't seem to compile...

@bruce-lindsay

Copy link
Copy Markdown
Contributor Author

@davidfowl resolved. Sorry I made an error

@bruce-lindsay

Copy link
Copy Markdown
Contributor Author

I have done everything from docker image microsoft/dotnet:2.1-sdk-stretch because the dotnet 2.1.4 doesn't tolerate the build target. as a result some blocks of code were windows only and could not be built or tested. I'm hoping I can lead on the review + CI to catch anything

The current .NET SDK does not support targeting .NET Core 2.1. Either target .NET Core 2.0 or lower, or use a version of the .NET SDK that supports .NET Core 2.1.

public class ConsoleLoggerOptions
{
public bool IncludeScopes { get; set; } = false;
public bool DisableColors { get; set; } = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No need to set default "default values". I'd recommend removing the = false; from this line and the one above it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 2bfbdfb

private IExternalScopeProvider _scopeProvider;

public ConsoleLoggerProvider(Func<string, LogLevel, bool> filter, bool includeScopes)
public ConsoleLoggerProvider(Func<string, LogLevel, bool> filter, bool includeScopes, bool disableColors = false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks like a breaking change. I recommend adding a 2nd constructor that has the extra parameter, and then chain the two constructors.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 2bfbdfb

_settings = _settings.Reload();

_includeScopes = _settings?.IncludeScopes ?? false;
bool disableColors = _settings?.DisableColors ?? false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you use var here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

addressed in 67c4ee5

@Eilon

Eilon commented Mar 5, 2018

Copy link
Copy Markdown
Contributor

Overall looks good to me, but I'm not a Logging expert, so I'll let someone from @muratg 's team review.

@muratg muratg left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good to me. @pakrym could you take a look?

@pakrym

pakrym commented Mar 15, 2018

Copy link
Copy Markdown
Contributor

Can you please add ConsoleLoggerOptions_IncludeScopes_IsReadFromLoggingConfiguration and ConsoleLoggerOptions_IncludeScopes_IsAppliedToLoggers test variations for console collors.

@bruce-lindsay

Copy link
Copy Markdown
Contributor Author

@pakrym added requested test variations

@pakrym

pakrym commented Apr 4, 2018

Copy link
Copy Markdown
Contributor

@muratg, this change involves a breaking change of rarely used IConsoleLoggerSettings interface. Are we fine with it?

@Eilon

Eilon commented Apr 4, 2018

Copy link
Copy Markdown
Contributor

I would add a 2nd interface that adds the new API. The bar for breaking changes is very high.

@pakrym

pakrym commented Apr 4, 2018

Copy link
Copy Markdown
Contributor

@Eilon or we can just not support this switch for the old way of doing things (IConsoleLoggerSettings is a remnant of the world before logging configuration refactoring).

@Eilon

Eilon commented Apr 4, 2018

Copy link
Copy Markdown
Contributor

I'm open to lots of options, but not ones involving breaking changes 😄 Your suggestion sounds fine to me.

@pakrym

pakrym commented Apr 4, 2018

Copy link
Copy Markdown
Contributor

@bruce-lindsay I had to do couple changes to avoid breaking changes in legacy IConsoleLoggerSettings code.

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