1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-06 06:50:17 +00:00

file rotate file test

This commit is contained in:
JessonChan
2016-04-13 09:05:16 +08:00
parent 22617aeb13
commit abaa1bbcac
2 changed files with 42 additions and 1 deletions

View File

@ -267,6 +267,10 @@ func (w *fileLogWriter) deleteOldLog() {
}
}()
if info == nil {
return
}
if !info.IsDir() && info.ModTime().Add(24*time.Hour*time.Duration(w.MaxDays)).Before(time.Now()) {
if strings.HasPrefix(filepath.Base(path), filepath.Base(w.fileNameOnly)) &&
strings.HasSuffix(filepath.Base(path), w.suffix) {