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

add argument to rotating file sink for rotate_on_open #823

Closed
wants to merge 2 commits into from

Conversation

pwm1234
Copy link

@pwm1234 pwm1234 commented Sep 6, 2018

when true, the log file will be rotated when it is opened so the newly constructed file will start off being empty

when true, the log file will be rotated when it is opened so the newly constructed file will start off being empty
@gabime
Copy link
Owner

gabime commented Sep 6, 2018

I think a “truncate” param is what you want. like in basic_file_sink.

@pwm1234
Copy link
Author

pwm1234 commented Sep 6, 2018

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.

@gabime
Copy link
Owner

gabime commented Sep 6, 2018

First, let me say THANK YOU for your work on spdlog and making it available!

You're very welcome :)

Do you really want the argument to be named truncate?

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..

If so, do you want me to make it using HEAD or am I okay at the 1.0 tag

Please use latest commit as the baseline for the PR.

@pwm1234
Copy link
Author

pwm1234 commented Sep 6, 2018

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..

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.

@pwm1234
Copy link
Author

pwm1234 commented Jan 9, 2019

Just checking on this pull request. Is there something I can do to get this change merged?

@gabime
Copy link
Owner

gabime commented Jan 10, 2019

@pwm1234 Please open a new pr. I see there are conflicts

@gabime gabime closed this Jan 10, 2019
@pwm1234 pwm1234 mentioned this pull request Jan 11, 2019
bachittle pushed a commit to bachittle/spdlog that referenced this pull request Dec 22, 2022
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

Successfully merging this pull request may close these issues.

3 participants