-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 argument to rotating file sink for rotate_on_open #823
Conversation
when true, the log file will be rotated when it is opened so the newly constructed file will start off being empty
I think a “truncate” param is what you want. like in basic_file_sink. |
First, let me say THANK YOU for your work on spdlog and making it available! Second, I did not know about the "truncate" param in basic_file_sink. But since truncate means to shorten or replace, which is different than "rotating," do you really want the argument to be named truncate? I am happy to do so, I just wanted to double-check. Third, is this a pull request that you would accept once we iron out the details? If so, do you want me to make it using HEAD or am I okay at the 1.0 tag? (I chose this because that is the tag that vcpkg is using.) Also, I was unsure how to test this new functionality. I will add a test if you point me in the right direction. |
You're very welcome :)
I was referring to the actual implementation. It depends the purpose - if the purpose is is just starting with empty file, then maybe truncating is good enough.. If the purpose is to rotate first, and lose an old file, then "rotate_on_open" is fine. Either way, the program is going to lose a log file..
Please use latest commit as the baseline for the PR. |
Yes, the purpose and implementation is to rotate first. An old log file will be lost only if the maximum number has already been reached. I will update the pull request to use the HEAD of the 1.x branch. |
Just checking on this pull request. Is there something I can do to get this change merged? |
@pwm1234 Please open a new pr. I see there are conflicts |
when true, the log file will be rotated when it is opened so the newly constructed file will start off being empty