diff --git a/logs/conn.go b/logs/conn.go index 2a29688a..5d78467b 100644 --- a/logs/conn.go +++ b/logs/conn.go @@ -64,8 +64,7 @@ func (c *connWriter) WriteMsg(when time.Time, msg string, level int) error { defer c.innerWriter.Close() } - logTimeStr := formatLogTime(when) - msg = logTimeStr + msg + msg = formatLogTime(when) + msg c.lg.Println(msg) return nil diff --git a/logs/console.go b/logs/console.go index 48d1e5b2..e6da0df9 100644 --- a/logs/console.go +++ b/logs/console.go @@ -74,10 +74,7 @@ func (c *consoleWriter) WriteMsg(when time.Time, msg string, level int) error { if level > c.Level { return nil } - - logTimeStr := formatLogTime(when) - msg = logTimeStr + msg - + msg = formatLogTime(when) + msg if goos := runtime.GOOS; goos == "windows" { c.lg.Println(msg) return nil diff --git a/logs/file.go b/logs/file.go index 16bf29c2..f277317c 100644 --- a/logs/file.go +++ b/logs/file.go @@ -121,8 +121,7 @@ func (w *fileLogWriter) WriteMsg(when time.Time, msg string, level int) error { //2016/01/12 21:34:33 // now := time.Now() d := when.Day() - logTimeStr := formatLogTime(when) - msg = logTimeStr + msg + "\n" + msg = formatLogTime(when) + msg + "\n" if w.Rotate { if w.needRotate(len(msg), d) {