natefinch / lumberjack

lumberjack is a log rolling package for Go
MIT License
4.76k stars 585 forks source link

If one log routine is switching files, will it affect the writing of other routine? #149

Closed longbozhan closed 2 years ago

longbozhan commented 2 years ago

As the Write func impl, will lock mutex, if this operation waste too much time, such as compress, other routine will block?

natefinch commented 2 years ago

Compress is done in a separate goroutine, so it won't block, specifically for this reason. At most, write will rename the current file and open a new one. That's still a lot for a single log write, but way shorter than than compression, and it shouldn't happen very often.