From ff1938054a3fe149540086f3941c97a84678a3ac Mon Sep 17 00:00:00 2001 From: "asta.xie" Date: Fri, 21 Mar 2014 14:07:03 +0800 Subject: [PATCH] add w.Rotate --- logs/file.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/logs/file.go b/logs/file.go index d0512e26..d61136c0 100644 --- a/logs/file.go +++ b/logs/file.go @@ -118,9 +118,9 @@ func (w *FileLogWriter) StartLogger() error { func (w *FileLogWriter) docheck(size int) { w.startLock.Lock() defer w.startLock.Unlock() - if (w.Maxlines > 0 && w.maxlines_curlines >= w.Maxlines) || + if w.Rotate && ((w.Maxlines > 0 && w.maxlines_curlines >= w.Maxlines) || (w.Maxsize > 0 && w.maxsize_cursize >= w.Maxsize) || - (w.Daily && time.Now().Day() != w.daily_opendate) { + (w.Daily && time.Now().Day() != w.daily_opendate)) { if err := w.DoRotate(); err != nil { fmt.Fprintf(os.Stderr, "FileLogWriter(%q): %s\n", w.Filename, err) return