浏览代码

tech(log): fixes extra param logging

bergquist 9 年之前
父节点
当前提交
7a6501640f
共有 1 个文件被更改,包括 16 次插入2 次删除
  1. 16 2
      pkg/log/log.go

+ 16 - 2
pkg/log/log.go

@@ -58,7 +58,14 @@ func Debug2(message string, v ...interface{}) {
 }
 
 func Info(format string, v ...interface{}) {
-	Root.Info(fmt.Sprintf(format, v))
+	var message string
+	if len(v) > 0 {
+		message = fmt.Sprintf(format, v)
+	} else {
+		message = format
+	}
+
+	Root.Info(message)
 }
 
 func Info2(message string, v ...interface{}) {
@@ -66,7 +73,14 @@ func Info2(message string, v ...interface{}) {
 }
 
 func Warn(format string, v ...interface{}) {
-	Root.Warn(fmt.Sprintf(format, v))
+	var message string
+	if len(v) > 0 {
+		message = fmt.Sprintf(format, v)
+	} else {
+		message = format
+	}
+
+	Root.Warn(message)
 }
 
 func Warn2(message string, v ...interface{}) {