Skip to content

Implement ISupportExternalScope#37

Merged
nblumhardt merged 4 commits into
datalust:devfrom
skomis-mm:feature/external-scope
Jan 6, 2021
Merged

Implement ISupportExternalScope#37
nblumhardt merged 4 commits into
datalust:devfrom
skomis-mm:feature/external-scope

Conversation

@skomis-mm
Copy link
Copy Markdown
Contributor

fixes #36

List<LogEventPropertyValue> scopeItems = null;
for (var scope = CurrentScope; scope != null; scope = scope.Parent)
List<LogEventPropertyValue> scopeItems = new List<LogEventPropertyValue>();

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.

Unfortunate allocation, but found no way to pass this by reference to the scope enumerating delegate.

var property = propertyFactory.CreateProperty(key, stateProperty.Value, destructureObject);
logEvent.AddPropertyIfAbsent(property);
logEvent.AddOrUpdateProperty(property);
}
Copy link
Copy Markdown
Contributor Author

@skomis-mm skomis-mm Jan 5, 2021

Choose a reason for hiding this comment

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

Since scope enumerating goes from the outer to the inner now we need to update existing property.

@nblumhardt
Copy link
Copy Markdown
Member

Works like a charm - thanks @skomis-mm!

@nblumhardt nblumhardt merged commit f51d46f into datalust:dev Jan 6, 2021
@skomis-mm skomis-mm deleted the feature/external-scope branch January 6, 2021 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use IExternalScopeProvider for logging scopes

2 participants