mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 22:11:29 +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)
|
dir := path.Dir(w.filename)
|
||||||
filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
|
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 !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)
|
os.Remove(path)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user