-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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 sync to file_helper #2343
Add sync to file_helper #2343
Conversation
Thanks. However since it is not used by any of spdlog sinks, I prefer not to add unused code, |
1 similar comment
Thanks. However since it is not used by any of spdlog sinks, I prefer not to add unused code, |
@espkk Reopened due to popular demand for fsync. Could you please fix the code so it passes the tests? |
Should be good now. I could add a sink for it but the use-cases can be different. I need it for termination, but someone might need it after each flush |
Thanks @espkk . I am wondering myself whether to
|
IMO, fsync on file sink should be flexible enough, while I would still prefer implementing custom sink if the desired behavior is sync-after-write |
For my use case (#2605), the third option would be the most convenient. |
Since file_helper already works well for managing file sinks and generally can be reused, it seems reasonable to me to implement fsync there which is required in some cases.
This adds
sync()
method to file_helper. It doesn't affect existing sinks and doesn't touch public interfaces.