natefinch / lumberjack

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

add timeformat into Logger #40

Closed asdfsx closed 7 years ago

asdfsx commented 7 years ago

In order to use a specific timeformat~

natefinch commented 7 years ago

Can you give me a reason why you need to change the backup time format? I just closed another PR that requested this, because it wasn't addressing a technical problem with the package.

asdfsx commented 7 years ago

Yes, it's not a technical problem, just Personal requirement. I used to use time format like "20060102", and I think maybe other people like something else.

natefinch commented 7 years ago

So, the problem with this is that if you change the time format then lumberjack won't recognize old rolled log files, and you could accidentally use a lot more space than you intend. I'd rather not give people that kind of footgun just so people can make a filename look nicer.

Also, you need to include the time down to the millisecond, to avoid collisions if you roll over the log quickly. There's a lot of thought that went into the current log file name.