-
Notifications
You must be signed in to change notification settings - Fork 29
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
Refactor to support use as a wrapper sink; add sink options #39
Conversation
…ctor to support usage as a wrapper class; fixes serilog#38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like the new design that compatible with existing sinks. Looks great 👍
Very interesting approach with the decorator + adapter implementation at the same time to retain compatibility with the old version. While still not that big of a fan of introducing a second interface, this approach is significantly better than the previous version and I understand the challenges of minimizing breaking changes: my Couple comments:
|
Hi, @julealgon . As for the second, the constructor with |
Ahhh I see. That makes sense, thanks for clarifying @skomis-mm ! |
RE your first point @julealgon - I left this as a bit of a "todo" while thinking about whether default values or a constructor on |
This sorts out some of the constructor proliferation discussed in #30 and implements the option suggested in #38.
All of the existing behavior is maintained, but consumers are encouraged to switch away from subclassing towards composition. The implementation achieves this currently by "composing" with itself to support the earlier subclassing usage.
Changes are shown in the updated README, copied below.
Getting started
Sinks that, for performance reasons, need to emit events in batches, can be implemented using
PeriodicBatchingSink
from this package.
First, install the package into your Sink project:
Then, instead of implementing Serilog's
ILogEventSink
, implementIBatchedLogEventSink
in your sink class:Finally, in your sink's configuration method, construct a
PeriodicBatchingSink
that wraps your batched sink: