1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-23 00:00:50 +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 {
lm := new(logMsg)
lm.level = loglevel
func (bl *BeeLogger) writeMsg(logLevel int, msg string) error {
if bl.enableFuncCallDepth {
_, file, line, ok := runtime.Caller(bl.loggerFuncCallDepth)
if !ok {
@ -184,14 +182,17 @@ func (bl *BeeLogger) writeMsg(loglevel int, msg string) error {
line = 0
}
_, filename := path.Split(file)
lm.msg = fmt.Sprintf("[%s:%d] %s", filename, line, msg)
msg = fmt.Sprintf("[%s:%d] %s", filename, line, msg)
} else {
lm.msg = msg
msg = msg
}
if bl.asynchronous {
lm := new(logMsg)
lm.level = logLevel
lm.msg = msg
bl.msg <- lm
} else {
bl.writeToLoggers(msg, loglevel)
bl.writeToLoggers(msg, logLevel)
}
return nil
}