mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 09:20:55 +00:00
fix log delete
This commit is contained in:
parent
d627ec013e
commit
8807c327d1
2
log.go
2
log.go
@ -202,8 +202,10 @@ func (w *FileLogWriter) deleteOldLog() {
|
||||
dir := path.Dir(w.filename)
|
||||
filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
|
||||
if !info.IsDir() && info.ModTime().Unix() < (time.Now().Unix()-60*60*24*w.maxdays) {
|
||||
if strings.HasPrefix(filepath.Base(path), filepath.Base(w.filename)) {
|
||||
os.Remove(path)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user