Skip to content

Per-sink custom formatters #742

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

Open
QuillUsr1 opened this issue Apr 2, 2025 · 1 comment
Open

Per-sink custom formatters #742

QuillUsr1 opened this issue Apr 2, 2025 · 1 comment

Comments

@QuillUsr1
Copy link

Just to start with - I think its great that we now have per-sink pattern formatters in v9.0.0 https://github.com/odygrd/quill/blob/master/examples/sink_formatter_override.cpp !

But I was wondering if it would be possible to go one step further, and integrate mutli-formatting with this feature. https://github.com/odygrd/quill/blob/master/examples/user_defined_types_multi_format.cpp.

The idea would be that logging through sink1 could use the {} formatter, and logging through sink2 could always use the {:p} formatter for example.

@odygrd
Copy link
Owner

odygrd commented Apr 3, 2025

Hey, i am not sure how easy would be to do that.

We just call format and that code runs internally by libfmt. I am not sure how easy it would be for the Sink to select formatter

One way i can think is the Sink could modify the format string before formatting, but then it would need to add the correct value inside ‘{}’ based on each type and it would need to have a mapping passed by the user for each type

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

No branches or pull requests

2 participants