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

EventLog Scopes #741

Merged
merged 1 commit into from
Jan 4, 2018
Merged

EventLog Scopes #741

merged 1 commit into from
Jan 4, 2018

Conversation

pakrym
Copy link
Contributor

@pakrym pakrym commented Dec 6, 2017

@pakrym pakrym requested a review from BrennanConroy December 6, 2017 17:17
@@ -9,10 +9,12 @@ namespace Microsoft.Extensions.Logging.EventLog
/// The provider for the <see cref="EventLogLogger"/>.
/// </summary>
[ProviderAlias("EventLog")]
public class EventLogLoggerProvider : ILoggerProvider
public class EventLogLoggerProvider : ILoggerProvider, ISupportExternalScope
Copy link
Member

Choose a reason for hiding this comment

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

breaking change technically?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While this is technically a breaking and adding interface can change overload resolution ISupportExternalScope would be new in the release so no one would be using it.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah not worried about this type of breaking change in this particular case.

Copy link
Contributor

Choose a reason for hiding this comment

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

But good to ask!

// Arrange
var loggerName = "Test";
var maxMessageSize = 50 + loggerName.Length + Environment.NewLine.Length;
var expectedMessage = loggerName + Environment.NewLine +
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 how we want messages to look?

Test
Message
Outer Scope
Inner Scope

Copy link
Member

Choose a reason for hiding this comment

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

@glennc For formatting

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.

:shipit:

@pakrym pakrym merged commit af9377a into dev Jan 4, 2018
@natemcmaster natemcmaster deleted the pakrym/ev-scopes branch November 6, 2018 22:41
@snakefoot
Copy link

snakefoot commented Dec 5, 2018

I'm curious about this change. When the logging provider (EventLogLoggerProvider) implements ISupportExternalScope then it means that the LoggerFactory-implementation will no longer call EventLogLogger.BeginScope. Instead the EventLogLogger must use the provided IExternalScopeProvider to get its scope-state.

But the EventLogLoggerProvider.GetLogger() doesn't pass the IExternalScopeProvider as parameter to the newly created EventLogLogger. Instead the EventLogLogger creates its own internal version, that is only exercised when calling BeginScope directly, but in the "real world" that will never happen.

Is it the intention that EventLogLogger should not perform logging of current scope?

@pakrym
Copy link
Contributor Author

pakrym commented Dec 5, 2018

Good catch. That was a bug that was fixed in the new versions: https://github.com/aspnet/Extensions/blob/master/src/Logging/Logging.EventLog/src/EventLogLoggerProvider.cs#L36

@snakefoot
Copy link

snakefoot commented Dec 5, 2018

Ahh it was hidden in the refactoring commit from dotnet/extensions#502. Sorry about the noise

@snakefoot
Copy link

Any reasons for having the stale copy around here? when the correct version now resides at new location?

@pakrym
Copy link
Contributor Author

pakrym commented Dec 5, 2018

Repository title says [Archived] Common logging abstractions and a few implementations. Project moved to https://github.com/aspnet/Extensions

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.

5 participants