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

Reinstate LoggerSinkConfiguration.Sink(ILogEventSink, LogEventLevel) #1889

Merged
merged 2 commits into from Mar 30, 2023

Conversation

nblumhardt
Copy link
Member

@nblumhardt nblumhardt commented Mar 30, 2023

I just switched Seq over to Serilog 3 dev and the latest versions of our dependencies, but because of some transitive dependencies in the build I hit:

System.MissingMethodException: Method not found: 'Serilog.LoggerConfiguration Serilog.Configuration.LoggerSinkConfiguration.Sink(Serilog.Core.ILogEventSink, Serilog.Events.LogEventLevel)'.
   at Serilog.SeqLoggerConfigurationExtensions.<>c__DisplayClass3_0.<Seq>b__0(LoggerSinkConfiguration wt)
   at Serilog.Configuration.LoggerSinkConfiguration.Wrap(LoggerSinkConfiguration loggerSinkConfiguration, Func`2 wrapSink, Action`1 configureWrappedSink, LogEventLevel restrictedToMinimumLevel, LoggingLevelSwitch levelSwitch)
   at Serilog.Configuration.LoggerSinkConfiguration.Conditional(Func`2 condition, Action`1 configureSink)
   at Serilog.SeqLoggerConfigurationExtensions.Seq(LoggerSinkConfiguration loggerSinkConfiguration, String serverUrl, LogEventLevel restrictedToMinimumLevel, Int32 batchPostingLimit, Nullable`1 period, String apiKey, String bufferBaseFilename, Nullable`1 bufferSizeLimitBytes, Nullable`1 eventBodyLimitBytes, LoggingLevelSwitch controlLevelSwitch, HttpMessageHandler messageHandler, Nullable`1 retainedInvalidPayloadsLimitBytes, Int32 queueSizeLimit)
   at Seq.Build.Program.Main(String[] rawArgs) in C:\projects\seq\ci\Seq.Build\Program.cs:line 33

We speculatively removed it in #1800.

I think this is going to be a common experience; for the cost of one overload that wasn't already [Obsolete] I think walking this change back is a good trade-off.

I've left the other removal from #1800 alone as we don't have any evidence of breakage at this point.

Copy link
Member

@augustoproiete augustoproiete left a comment

Choose a reason for hiding this comment

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

LGTM

@SimonCropp SimonCropp merged commit 883e208 into serilog:dev Mar 30, 2023
1 check passed
publicApi.ShouldMatchApproved(options =>
{
// Comment this line out to view the failure as a diff. Leave it here so that CI builds don't hang when this test fails.
options.NoDiff();
Copy link
Contributor

Choose a reason for hiding this comment

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

How does hang look like? I do not use NoDiff in other repos and did not see issues.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good question, I may have jumped the gun here, based on experience with other tools that launch windowed executables for this.

/// <seealso cref="Sink(ILogEventSink, LogEventLevel, LoggingLevelSwitch?)"/>
/// <returns>Configuration object allowing method chaining.</returns>
/// <remarks>Sink configuration methods that specify <paramref name="restrictedToMinimumLevel"/> should also specify <see cref="LoggingLevelSwitch"/>.</remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not obsolete?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's impossible to stop the compiler selecting it when doing overload resolution, and thus marking it obsolete results in a spurious warning.

@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

4 participants