From f02ff0420d75a3d1d09e1e400e6bf0250848d6f7 Mon Sep 17 00:00:00 2001 From: JessonChan Date: Thu, 24 Mar 2016 20:22:42 +0800 Subject: [PATCH] no need to call Sprintf when no args --- logs/log.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/logs/log.go b/logs/log.go index cf0f6346..3d4a4d60 100644 --- a/logs/log.go +++ b/logs/log.go @@ -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)