natefinch / lumberjack

lumberjack is a log rolling package for Go
MIT License
4.86k stars 599 forks source link

smaller sizes increments #37

Open anarcat opened 7 years ago

anarcat commented 7 years ago

it's too bad that the file size rotation limit is in megabytes - that's actually a huge number for embeded platforms. it would be better to rotate on kilobytes or, fundamentally, bytes: one can then use multiples to find the proper value using, e.g. humanize: fmt.Println("10 MB: %d", 10 * humanize.MiByte)...

i understand this may involve an API change, but maybe there could just be another MaxBytes settings?

natefinch commented 7 years ago

Yeah, in retrospect, I realized that making the rotation size in megabytes was a mistake. It should have been bytes, like most other Go sizes.

Are you actually planning on using lumberjack in an embedded platform? I'd be interested to hear what the constraints are like.

anarcat commented 7 years ago

i'm building this tool called wallabako that runs on Kobo e-readers. /var/log is ... 16KB. There's more storage elsewhere (e.g. ~3GB) so i worked around that problem, but i would like to use the normal log rotation because (presumably) it would also cleanup those logs on reboot...

natefinch commented 7 years ago

Neat. :) Adding a MaxBytes value is certainly an option, and wouldn't be too hard. Give me a little time to think about it.

anarcat commented 7 years ago

thanks!

patrickmead commented 5 years ago

@natefinch My team is also interested in using lumberjack on an embedded device.

Are you still considering making this change? If time is an issue are you open to a contribution? Thank you

kirankumaralluvada commented 4 years ago

Hi.. I could see the change to reduce the max size of log file is still not merged to lumberjack. Are there any blockers? It will be useful. Even time based log rotation periodically also helps.

quen2404 commented 4 years ago

Hi @natefinch, thank you for your work & this repository. Is there something blocking the PR #97? I need this feature too for an embedded environment. If something is missing or blocking, i can contribute to resolve that.

natefinch commented 4 years ago

The main problem is "deprecating" the other value.

I think what we need is a v3 that just switches to bytes (and fixes some other problems with the interface in this package). I have been meaning to do that for a while now.

quen2404 commented 4 years ago

Ok, is there a roadmap ? Do you need help ?

natefinch commented 4 years ago

Sorta and maybe :)

see #115