Skip to content

Conversation

mariozski
Copy link
Contributor

This PR is implementation of #1006
Add Suspend and Reset methods to LogContext to allow removing enrichers.
Add tests for Suspend and Reset methods.

@nblumhardt
Copy link
Member

Great!

Thanks, will take a look 👍

CC @serilog/reviewers-core.

Copy link
Member

@nblumhardt nblumhardt left a comment

Choose a reason for hiding this comment

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

Looks great! Just one suggestion.

/// </summary>
public static void Reset()
{
var enrichers = GetOrCreateEnricherStack();
Copy link
Member

Choose a reason for hiding this comment

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

It's not necessary to create the enricher stack here if it doesn't exist; we could use:

             var enrichers = Enrichers;
             if (enrichers != null && enrichers != ImmutableStack<ILogEventEnricher>.Empty)
                 Enrichers = ImmutableStack<ILogEventEnricher>.Empty;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, that totally makes sense, will fix that.

@mariozski
Copy link
Contributor Author

@nblumhardt I have changed code according to your suggestions. Please take a look on it, when you have some time.

@nblumhardt
Copy link
Member

Fantastic, thanks. Just made some very minor adjustments to the documentation wording; will merge once CI completes :-)

@nblumhardt nblumhardt merged commit 67ff309 into serilog:dev Jul 28, 2017
@nblumhardt nblumhardt mentioned this pull request Jul 28, 2017
@merbla
Copy link
Contributor

merbla commented Jul 28, 2017

👍

@nblumhardt nblumhardt mentioned this pull request Nov 23, 2017
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.

3 participants