mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 09:00:55 +00:00
fix log delete
This commit is contained in:
parent
d627ec013e
commit
8807c327d1
4
log.go
4
log.go
@ -202,7 +202,9 @@ 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) {
|
||||
os.Remove(path)
|
||||
if strings.HasPrefix(filepath.Base(path), filepath.Base(w.filename)) {
|
||||
os.Remove(path)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user