natefinch / lumberjack

lumberjack is a log rolling package for Go
MIT License
4.89k stars 600 forks source link

Fine grain MaxAge #130

Open gtato opened 3 years ago

gtato commented 3 years ago

Is it possible to have a MaxAge smaller than 1 day? Say 1 hour or even in minutes?

phuslu commented 3 years ago

I think providing MaxAge is not a good design. usually we use a implicit and background goroutine to promise MaxAge(otherwise MaxAge is not a real MaxAge and will supervise people), so it introduce a Close or Cleanup issue.

For you question, I think you can use 'robfig/cron' to trigger rotation and make MaxBackups works as your exception.

natefinch commented 2 years ago

This is a time.Duration in v3 (which is not tagged yet but exists as a branch)