Commit bcac4bb8 authored by youngsterxyf's avatar youngsterxyf

accept @JessonChan suggestion

parent 0e17e2a3
...@@ -64,8 +64,7 @@ func (c *connWriter) WriteMsg(when time.Time, msg string, level int) error { ...@@ -64,8 +64,7 @@ func (c *connWriter) WriteMsg(when time.Time, msg string, level int) error {
defer c.innerWriter.Close() defer c.innerWriter.Close()
} }
logTimeStr := formatLogTime(when) msg = formatLogTime(when) + msg
msg = logTimeStr + msg
c.lg.Println(msg) c.lg.Println(msg)
return nil return nil
......
...@@ -74,10 +74,7 @@ func (c *consoleWriter) WriteMsg(when time.Time, msg string, level int) error { ...@@ -74,10 +74,7 @@ func (c *consoleWriter) WriteMsg(when time.Time, msg string, level int) error {
if level > c.Level { if level > c.Level {
return nil return nil
} }
msg = formatLogTime(when) + msg
logTimeStr := formatLogTime(when)
msg = logTimeStr + msg
if goos := runtime.GOOS; goos == "windows" { if goos := runtime.GOOS; goos == "windows" {
c.lg.Println(msg) c.lg.Println(msg)
return nil return nil
......
...@@ -121,8 +121,7 @@ func (w *fileLogWriter) WriteMsg(when time.Time, msg string, level int) error { ...@@ -121,8 +121,7 @@ func (w *fileLogWriter) WriteMsg(when time.Time, msg string, level int) error {
//2016/01/12 21:34:33 //2016/01/12 21:34:33
// now := time.Now() // now := time.Now()
d := when.Day() d := when.Day()
logTimeStr := formatLogTime(when) msg = formatLogTime(when) + msg + "\n"
msg = logTimeStr + msg + "\n"
if w.Rotate { if w.Rotate {
if w.needRotate(len(msg), d) { if w.needRotate(len(msg), d) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment