no need to call Sprintf when no args

This commit is contained in:
JessonChan 2016-03-24 20:22:42 +08:00
parent 06299fa47b
commit f02ff0420d
1 changed files with 3 additions and 1 deletions

View File

@ -256,7 +256,9 @@ func (bl *BeeLogger) writeMsg(logLevel int, msg string, v ...interface{}) error
} else {
msg = levelPrefix[logLevel] + msg
}
msg = fmt.Sprintf(msg, v...)
if len(v) > 0 {
msg = fmt.Sprintf(msg, v...)
}
when := time.Now()
if bl.enableFuncCallDepth {
_, file, line, ok := runtime.Caller(bl.loggerFuncCallDepth)