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

Add DisableColors option (#764) #772

Merged
merged 7 commits into from
Apr 4, 2018
Merged

Conversation

bruce-lindsay
Copy link
Contributor

No description provided.

@dnfclas
Copy link

dnfclas commented Mar 3, 2018

CLA assistant check
All CLA requirements met.

@davidfowl
Copy link
Member

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

@bruce-lindsay
Copy link
Contributor Author

@davidfowl resolved. Sorry I made an error

@bruce-lindsay
Copy link
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.

@@ -8,5 +8,6 @@ namespace Microsoft.Extensions.Logging.Console
public class ConsoleLoggerOptions
{
public bool IncludeScopes { get; set; } = false;
public bool DisableColors { get; set; } = false;
Copy link
Member

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

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
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

@@ -77,11 +86,14 @@ private void OnConfigurationReload(object state)
_settings = _settings.Reload();

_includeScopes = _settings?.IncludeScopes ?? false;
bool disableColors = _settings?.DisableColors ?? false;
Copy link
Member

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

Eilon commented Mar 5, 2018

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

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.

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

@pakrym
Copy link
Contributor

pakrym commented Mar 15, 2018

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

@bruce-lindsay
Copy link
Contributor Author

@pakrym added requested test variations

@pakrym
Copy link
Contributor

pakrym commented Apr 4, 2018

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

@Eilon
Copy link
Member

Eilon commented Apr 4, 2018

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

@pakrym
Copy link
Contributor

pakrym commented Apr 4, 2018

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

Eilon commented Apr 4, 2018

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

@pakrym
Copy link
Contributor

pakrym commented Apr 4, 2018

@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.

None yet

6 participants