serilog-sinks-console
serilog-sinks-console copied to clipboard
ConsoleSink class being internal
Hello, what is the reason for making the ConsoleSink class internal? I am writing my own ad-hoc limiting sink and cannot make use of ConsoleSink because it cannot be instantiated and passed inside my sink.
I have no problems with GraylogSink because it is public, so I propose to make ConsoleSync public too.
Hi! Instead of constructing the sink directly, use LoggerSinkConfiguration.Wrap(..:
var limitingSink = LoggerSinkConfiguration.Wrap(
enclosed => new LimitingSink(enclosed),
wt => wt.Console());
This will work with all existing Serilog sinks, and automatically handles correct IDisposable and IAsyncDisposable forwarding to the wrapped sink (removing the need to implement these on your wrapper sink type).
See also https://github.com/serilog/serilog/pull/2060 - HTH!