Skip to content

FileChannel: make it possible to override ArchiveStrategy and RotateStrategy#3101

Closed
oktal wants to merge 1 commit intopocoproject:develfrom
Abc-Arbitrage:custom-strategy-filechannel
Closed

FileChannel: make it possible to override ArchiveStrategy and RotateStrategy#3101
oktal wants to merge 1 commit intopocoproject:develfrom
Abc-Arbitrage:custom-strategy-filechannel

Conversation

@oktal
Copy link
Copy Markdown
Contributor

@oktal oktal commented Sep 18, 2020

Currently, the FileChannel offer limited variants of ArchiveStrategy and RotateStrategy, based on the properties of the channel.

However, it might be useful for the user to provide its own ArchiveStrategy or RotateStrategy.
Such a use case would be, for example, to add a header every-time a new log file is created (or rotated).

Without access to the ArchiveStrategy, this is currently not possible.

This Pull Request just makes it possible for the user to inherit from FileChannel and override createArchiveStrategy or createRotationStrategy virtual functions.

Note that this PR also adds a new open() function to the ArchiveStrategy interface so that the user can know from the strategy that a log file has been opened by the FileChannel and implement custom behavior from there (such as writing a header to the file).

@oktal oktal changed the base branch from master to devel September 18, 2020 08:00
@obiltschnig
Copy link
Copy Markdown
Member

Thanks, but please clean-up the pull request as it currently has 178 (!) modified files.

@oktal oktal force-pushed the custom-strategy-filechannel branch from 0877da8 to fa70c98 Compare September 18, 2020 08:02
@oktal
Copy link
Copy Markdown
Contributor Author

oktal commented Sep 18, 2020

Yes, I initially branched out from master. I rebased my branch on top of devel, the PR should be clean now.

@obiltschnig obiltschnig self-assigned this Sep 18, 2020
@obiltschnig obiltschnig added this to the Release 1.11.0 milestone Sep 18, 2020
@obiltschnig
Copy link
Copy Markdown
Member

Thank you!

@aleks-f
Copy link
Copy Markdown
Member

aleks-f commented May 30, 2022

@oktal can you please write tests for this feature?

@aleks-f
Copy link
Copy Markdown
Member

aleks-f commented Mar 17, 2023

#3810

@aleks-f aleks-f closed this Mar 17, 2023
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