1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 22:51:29 +00:00

for better performance

This commit is contained in:
JessonChan 2016-03-24 20:27:00 +08:00
parent f02ff0420d
commit 52a0b657b7

View File

@ -597,6 +597,9 @@ func formatLog(f interface{}, v ...interface{}) string {
switch f.(type) {
case string:
msg = f.(string)
if len(v) == 0 {
return msg
}
if strings.Contains(msg, "%") && !strings.Contains(msg, "%%") {
//format string
} else {
@ -604,7 +607,11 @@ func formatLog(f interface{}, v ...interface{}) string {
msg += strings.Repeat(" %v", len(v))
}
default:
msg = fmt.Sprint(f) + strings.Repeat(" %v", len(v))
msg = fmt.Sprint(f)
if len(v) == 0 {
return msg
}
msg += strings.Repeat(" %v", len(v))
}
return fmt.Sprintf(msg, v...)
}