lumberjack
lumberjack copied to clipboard
Implement BeforeDeleteFunc
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.