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

some typo fixed

This commit is contained in:
JessonChan 2016-01-26 09:29:04 +08:00
parent b5a07c6ba8
commit f2567bc114
2 changed files with 13 additions and 16 deletions

View File

@ -61,12 +61,12 @@ func NewConsole() Logger {
} }
// Init init console logger. // Init init console logger.
// jsonconfig like '{"level":LevelTrace}'. // jsonConfig like '{"level":LevelTrace}'.
func (c *consoleWriter) Init(jsonconfig string) error { func (c *consoleWriter) Init(jsonConfig string) error {
if len(jsonconfig) == 0 { if len(jsonConfig) == 0 {
return nil return nil
} }
return json.Unmarshal([]byte(jsonconfig), c) return json.Unmarshal([]byte(jsonConfig), c)
} }
// WriteMsg write message in console. // WriteMsg write message in console.
@ -75,7 +75,7 @@ func (c *consoleWriter) WriteMsg(when time.Time, msg string, level int) error {
return nil return nil
} }
msg = formatLogTime(when) + msg msg = formatLogTime(when) + msg
if goos := runtime.GOOS; goos == "windows" { if runtime.GOOS == "windows" {
c.lg.Println(msg) c.lg.Println(msg)
return nil return nil
} }

View File

@ -118,19 +118,16 @@ func (w *fileLogWriter) WriteMsg(when time.Time, msg string, level int) error {
if level > w.Level { if level > w.Level {
return nil return nil
} }
//2016/01/12 21:34:33
// now := time.Now()
d := when.Day()
msg = formatLogTime(when) + msg + "\n" msg = formatLogTime(when) + msg + "\n"
if w.Rotate { if w.Rotate {
d := when.Day()
if w.needRotate(len(msg), d) { if w.needRotate(len(msg), d) {
w.Lock() w.Lock()
if w.needRotate(len(msg), d) { if w.needRotate(len(msg), d) {
if err := w.doRotate(when); err != nil { if err := w.doRotate(when); err != nil {
fmt.Fprintf(os.Stderr, "FileLogWriter(%q): %s\n", w.Filename, err) fmt.Fprintf(os.Stderr, "FileLogWriter(%q): %s\n", w.Filename, err)
} }
} }
w.Unlock() w.Unlock()
} }