Skip to content

Commit

Permalink
remove file bug fixed
Browse files Browse the repository at this point in the history
remove file by filename and file suffix
  • Loading branch information
JessonChan committed Mar 4, 2016
1 parent 2a14847 commit 3379a2b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion logs/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ func (w *fileLogWriter) deleteOldLog() {
}()

if !info.IsDir() && info.ModTime().Unix() < (time.Now().Unix()-60*60*24*w.MaxDays) {
if strings.HasPrefix(filepath.Base(path), filepath.Base(w.Filename)) {
if strings.HasPrefix(filepath.Base(path), w.fileNameOnly) &&
strings.HasSuffix(filepath.Base(path), w.suffix) {
os.Remove(path)
}
}
Expand Down

0 comments on commit 3379a2b

Please sign in to comment.