spdlog-rs icon indicating copy to clipboard operation
spdlog-rs copied to clipboard

[Feature Request] Decouple `Sink` trait

Open SpriteOvO opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

Currently, Sink has many methods beyond its fundamental semantics. If a downstream crate is going to implement a Sink type, a very large amount of boring boilerplate code needs to be written. This is a pain.

Inside spdlog-rs, we have a pretty dirty internal macro (common_impl!) to solve this problem. But since it's really, really, really dirty, I think it's best not to make this macro public and instead find a way to redesign the trait Sink.

Describe the solution you'd like

Maybe lighten Sink to just 2 methods log and flush, then move the other methods (should_log, level_filter, set_level_filter, set_formatter and set_error_handler) into a new public struct that will be a wrapper for a Sink. Maybe name the new struct SinkAdaptor? I still need to think it through.

SpriteOvO avatar Jul 25 '24 14:07 SpriteOvO