1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 21:10:55 +00:00

code refactor and format

This commit is contained in:
JessonChan 2016-01-13 09:24:27 +08:00
parent 7663d50c97
commit fb5b04506a

View File

@ -238,7 +238,9 @@ func (w *fileLogWriter) lines() (int, error) {
// new file name like xx.2013-01-01.2.log // new file name like xx.2013-01-01.2.log
func (w *fileLogWriter) doRotate() error { func (w *fileLogWriter) doRotate() error {
_, err := os.Lstat(w.Filename) _, err := os.Lstat(w.Filename)
if err == nil { if err != nil {
return err
}
// file exists // file exists
// Find the next available number // Find the next available number
num := 1 num := 1
@ -273,9 +275,8 @@ func (w *fileLogWriter) doRotate() error {
if renameErr != nil { if renameErr != nil {
return fmt.Errorf("Rotate: %s\n", renameErr) return fmt.Errorf("Rotate: %s\n", renameErr)
} }
}
return nil return nil
} }
func (w *fileLogWriter) deleteOldLog() { func (w *fileLogWriter) deleteOldLog() {