-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Add a trivial callback sink #2610
Conversation
it will call a custom callback, each time something is logged. the code was initially cloned from `basic_file_sink.h` required test, example and readme sample, added
it was an ordering problem
Thanks @maghorbani . I am not sure. Whats exactly the use case here? This can be achieved already by implementing custom sink just as easily. |
Well I needed it to be like this, so my custom sink would not be an additional patch to spdlog in every single project of mine. I just thought that, it is not harmful to have a general purpose sink. |
If there a popular demand for such think, I don't mind adding this. Which issues mention this? |
here are some that I found, searching I'm not sure if it worth it to be merged, if so, please let me know, and I will improve the new sink to meet your reasonable advice:
|
Lets start with a very basic, single lambda callback (the one with the the log_msg arg). Thanks! |
the callbacks struct deleted and the callback function type is just a typedef
Thanks @maghorbani . Merged. |
Minor extension of gabime#2610 Need to if serves the purpose
I needed such a functionality, to receive logs in a callback function, so I added this sink to the library.
The new sink, will call a custom callback, each time something is logged.
The code was initially cloned from
basic_file_sink.h
.Required test, example and readme sample, added.