Commit 3379a2b7 authored by JessonChan's avatar JessonChan

remove file bug fixed

remove file by filename and file suffix
parent 2a148473
...@@ -256,7 +256,8 @@ func (w *fileLogWriter) deleteOldLog() { ...@@ -256,7 +256,8 @@ func (w *fileLogWriter) deleteOldLog() {
}() }()
if !info.IsDir() && info.ModTime().Unix() < (time.Now().Unix()-60*60*24*w.MaxDays) { 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) os.Remove(path)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment