Skip to content

Custom rotate, archive and purge strategies for FileChannel#3810

Merged
aleks-f merged 2 commits intopocoproject:develfrom
andrewauclair:filechannel-custom-strategies
Mar 18, 2023
Merged

Custom rotate, archive and purge strategies for FileChannel#3810
aleks-f merged 2 commits intopocoproject:develfrom
andrewauclair:filechannel-custom-strategies

Conversation

@andrewauclair
Copy link
Copy Markdown
Contributor

This is an attempt at making an improved version of #3101 that has tests.

setRotationStrategy, setArchiveStrategy and setPurgeStrategy allow setting custom strategies to be used by the FileChannel.

These new functions take a non-null pointer and FileChannel owns the pointer after the call and will delete it when necessary.

Also changed FileChannel to use a new NullRotationStrategy and NullPurgeStrategy instead of null pointers.

One thing to note about these changes right now is that setting a property will still internally create a new strategy in FileChannel, overwriting the one provided to the set strategy functions. I think this is ok and I don't have any better ideas right now.

Personally, I've wanted this ability with Poco at work for a while so that we can start each log file with the version of software. It's currently difficult to know what version a customer is using when they send us log files.

@andrewauclair andrewauclair changed the title Adding the ability to set custom rotate, archive and purge strategies Custom rotate, archive and purge strategies for FileChannel Sep 22, 2022
@aleks-f
Copy link
Copy Markdown
Member

aleks-f commented Mar 17, 2023

@andrewauclair for some reason, this did not trigger CI builds. can you please push a dummy commit to trigger it so we can see it green before merge. I'll mark it for 1.13.0

@aleks-f aleks-f merged commit 66e93f9 into pocoproject:devel Mar 18, 2023
aleks-f pushed a commit that referenced this pull request Nov 27, 2023
* Adding the ability to set custom rotate, archive and purge strategies.

* Force CI
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.

2 participants