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

[Feature Request] Decouple Sink trait #71

Open
SpriteOvO opened this issue Jul 25, 2024 · 0 comments
Open

[Feature Request] Decouple Sink trait #71

SpriteOvO opened this issue Jul 25, 2024 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@SpriteOvO
Copy link
Owner

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 SpriteOvO added the enhancement New feature or request label Jul 25, 2024
@SpriteOvO SpriteOvO added this to the v0.5.0 milestone Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant