1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-26 05:21:30 +00:00

decr malloc new object

This commit is contained in:
JessonChan 2016-01-12 22:32:20 +08:00
parent 12e7f0f94a
commit bd0f3c29fa

View File

@ -174,9 +174,7 @@ func (bl *BeeLogger) writeToLoggers(msg string, level int) {
} }
} }
func (bl *BeeLogger) writeMsg(loglevel int, msg string) error { func (bl *BeeLogger) writeMsg(logLevel int, msg string) error {
lm := new(logMsg)
lm.level = loglevel
if bl.enableFuncCallDepth { if bl.enableFuncCallDepth {
_, file, line, ok := runtime.Caller(bl.loggerFuncCallDepth) _, file, line, ok := runtime.Caller(bl.loggerFuncCallDepth)
if !ok { if !ok {
@ -184,14 +182,17 @@ func (bl *BeeLogger) writeMsg(loglevel int, msg string) error {
line = 0 line = 0
} }
_, filename := path.Split(file) _, filename := path.Split(file)
lm.msg = fmt.Sprintf("[%s:%d] %s", filename, line, msg) msg = fmt.Sprintf("[%s:%d] %s", filename, line, msg)
} else { } else {
lm.msg = msg msg = msg
} }
if bl.asynchronous { if bl.asynchronous {
lm := new(logMsg)
lm.level = logLevel
lm.msg = msg
bl.msg <- lm bl.msg <- lm
} else { } else {
bl.writeToLoggers(msg, loglevel) bl.writeToLoggers(msg, logLevel)
} }
return nil return nil
} }