Skip to content

Commit

Permalink
file: delete outdated files after rotate (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfaint authored Jan 31, 2020
1 parent 10cf3e3 commit f79ab8a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ func (l *fileLogger) write(m Messager) (int, error) {
l.openDay = now.Day()
l.currentSize = 0
l.currentLines = 0

if err := l.deleteOutdatedFiles(); err != nil {
return bytesWrote, fmt.Errorf("delete outdated file: %v", err)
}
}
}
return bytesWrote, nil
Expand Down

0 comments on commit f79ab8a

Please sign in to comment.