lumberjack icon indicating copy to clipboard operation
lumberjack copied to clipboard

Implement BeforeDeleteFunc

Open kaiiorg opened this issue 1 year ago • 0 comments

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.

kaiiorg avatar Nov 20 '23 23:11 kaiiorg