natefinch / lumberjack

lumberjack is a log rolling package for Go
MIT License
4.8k stars 591 forks source link

Add pre & post rotate actions. #45

Open ecw19 opened 7 years ago

ecw19 commented 7 years ago

Sometimes we need to perform certain actions before or after logger rotation. It would be very useful if we can have these functions in.

natefinch commented 7 years ago

Do you have an example of what you'd like to do before or after a rotation? I'm a little wary of letting people define arbitrary functions for these actions, because this happens inside the time of a log writing, so if you do something that takes a long time, the time to log a single line could be very long.

swt2c commented 7 years ago

I work with @ecw19 on the same project. I am not sure why we added PreRotateAction, as we don't appear to be using it. Perhaps just for completeness?

We use the PostRotateAction to upload logs to our analytics service.