Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid creating SafeAggregateSink wrapper around empty list #1878

Merged
merged 2 commits into from Mar 13, 2023

Conversation

sungam3r
Copy link
Contributor

No description provided.

@@ -18,6 +18,8 @@ class SafeAggregateSink : ILogEventSink
{
readonly ILogEventSink[] _sinks;

internal static SafeAggregateSink Empty = new(new ILogEventSink[0]);
Copy link
Member

Choose a reason for hiding this comment

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

This appears to be unused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sink ??= SafeAggregateSink.Empty; in another file.

@nblumhardt
Copy link
Member

In the majority of applications, where there are a nonzero number of sinks, wouldn't this just lead to an additional/wasted/long-lived instance of SafeAggregateSink and an empty array?

@sungam3r
Copy link
Contributor Author

I removed field.

@nblumhardt nblumhardt merged commit 19d8b1a into serilog:dev Mar 13, 2023
@nblumhardt
Copy link
Member

LGTM! 👍

@sungam3r sungam3r deleted the sink branch March 13, 2023 07:23
@nblumhardt nblumhardt mentioned this pull request Jun 19, 2023
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.

None yet

3 participants