Repository navigation
Add size-based rotating sink with timestamped archive names - #3691
Closed
Yaki-Blake wants to merge 1 commit into
Closed
Yaki-Blake wants to merge 1 commit into
Yaki-Blake wants to merge 1 commit into
Conversation
Issue gabime#580 asks for size-based rotation with the rotated files named after a timestamp instead of a .1/.2 index (logrotate's dateext). rotating_file_sink hardcodes the suffixes; daily_file_sink/hourly_file_sink take a FileNameCalc but only rotate on time. The active file keeps a stable name because file_helper opens it in append mode -- a timestamped active name would start a new file on every process start and stop enforcing max_size across restarts. Additive only: no existing header or source is modified. Closes gabime#580
Owner
|
Thanks. Not sure I want to add whole new sink for this rarely required feature. Closing for now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #580.
Adds
rotating_datetime_file_sink: rotates on size likerotating_file_sink, but each rotated file is renamed to a name produced by aFileNameCalctemplate argument -- the same conventiondaily_file_sink/hourly_file_sinkalready use, so one calculator can be shared by all three.The active file keeps a fixed name on purpose:
file_helperopens it in append mode, so a restarted process continues the same file andmax_sizekeeps being enforced. A timestamp in the active name would start a new file on every run (measured: two runs give 2 files instead of 1), silently defeatingmax_size/max_filesacross restarts. That is whatrotate_on_openis for.API mirrors
rotating_file_sink(set_max_size,set_max_files,set_buffer_size,rotate_now,rotate_on_open). Additive only -- no existing header or source is modified. 10 Catch2 cases added; full suite passes with MSVC 19.51 and MinGW g++ 8.1, header-only and compiled lib, no warnings.