log
log copied to clipboard
FileWriter MaxBackups description is misleading :v
Heyho,
Awesome lib! Just found a bit of a feature description mismatch.
The FileWriter claims that MaxBackups=0 keeps all old log files, but the code never had this option implemented, setting the value to 0 actually removes everything but the newest.
Checked out the history, and that was always the behavior. And I think allowing an infinitely growing log trail is more dangerous than not. So, my only recommendation would be to update phrasing as it seems like that everyone was using it with some value until now.
Relevant source snippet
if w.Cleaner != nil {
w.Cleaner(w.Filename, w.MaxBackups, matches)
} else {
for i := 0; i < len(matches)-w.MaxBackups-1; i++ {
os.Remove(filepath.Join(dir, matches[i].Name()))
}
}
Oh, and thanks for the hard work, and have a wonderful day!