1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 21:01:31 +00:00

make daily rotate

This commit is contained in:
JessonChan 2016-05-06 12:11:14 +08:00
parent fa8d94fa69
commit b28581a463

View File

@ -167,6 +167,9 @@ func (w *fileLogWriter) initFd() error {
w.dailyOpenTime = time.Now() w.dailyOpenTime = time.Now()
w.dailyOpenDate = w.dailyOpenTime.Day() w.dailyOpenDate = w.dailyOpenTime.Day()
w.maxLinesCurLines = 0 w.maxLinesCurLines = 0
if w.Daily {
go w.dailyRotate(w.dailyOpenTime)
}
if fInfo.Size() > 0 { if fInfo.Size() > 0 {
count, err := w.lines() count, err := w.lines()
if err != nil { if err != nil {
@ -174,9 +177,6 @@ func (w *fileLogWriter) initFd() error {
} }
w.maxLinesCurLines = count w.maxLinesCurLines = count
} }
if w.Daily {
go w.dailyRotate(w.dailyOpenTime)
}
return nil return nil
} }