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

Implement BeforeDeleteFunc #199

Open
wants to merge 1 commit into
base: v2.0
Choose a base branch
from

Conversation

kaiiorg
Copy link

@kaiiorg kaiiorg commented Nov 20, 2023

Looking to use lumberjack for a personal project and the feature request in #195 would be a nice-to-have, so I implemented it myself.

I did this by adding a function pointer to the Logger struct and calling it just before deleting the file (after checking if it is nil, of course). I copy/pasted the TestCleanupExistingBackups test to TestCleanupExistingBackups_CallsCallback (so I know we're testing it with a known good test) and just increment a counter and validate that counter is the number we expect.

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.

1 participant