remove file bug fixed

remove file by filename and file suffix
This commit is contained in:
JessonChan 2016-03-04 10:43:57 +08:00
parent 2a148473e9
commit 3379a2b7ed
1 changed files with 2 additions and 1 deletions

View File

@ -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)
}
}