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

Initial support for IAsyncDisposable sinks #1750

Merged
merged 7 commits into from Sep 12, 2022

Conversation

nblumhardt
Copy link
Member

Resolves #1749

This is admittedly very heavy on #if. We may be able to do better by polyfilling IAsyncDisposable and ValueTask for older platforms - keen to explore this, too.

Gets some tests and feature flags in place, though, which should be a good start. Eyes appreciated :-)

Copy link
Contributor

@skomis-mm skomis-mm left a comment

Choose a reason for hiding this comment

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

Looks good overall 👍
We should also implement IAsyncDisposable on the following types:

  • ConditionalSink
  • RestrictedSink
  • SecondaryLoggerSink

src/Serilog/Core/Sinks/DisposingAggregateSink.cs Outdated Show resolved Hide resolved
src/Serilog/LoggerConfiguration.cs Outdated Show resolved Hide resolved
@nblumhardt
Copy link
Member Author

Thank you @skomis-mm 👍

Fixed, and some more test coverage added :-)

@nblumhardt nblumhardt merged commit 7740c90 into serilog:dev Sep 12, 2022
@nblumhardt nblumhardt mentioned this pull request Sep 12, 2022
Twinki14 pushed a commit to Twinki14/CitizenFX.Extensions.Client.Serilog that referenced this pull request Dec 30, 2023
* Support IAsyncDisposable.DisposeAsync() on Logger, and add Log.CloseAndFlushAsync()

* Add tests for Log.CloseAndFlushAsync()

* Seal DisposeAggregatingSink

* Fix tests

* Add missing ConfigureAwait(false)

* Implement IAsyncDisposable on remaining sink wrapper types

* More test coverage
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.

Support IAsyncDisposable on Logger and sinks
3 participants