瀏覽代碼

string formating fixes

bergquist 7 年之前
父節點
當前提交
12c9860882

+ 1 - 1
pkg/api/live/conn.go

@@ -70,7 +70,7 @@ func (c *connection) readPump() {
 func (c *connection) handleMessage(message []byte) {
 	json, err := simplejson.NewJson(message)
 	if err != nil {
-		log.Error(3, "Unreadable message on websocket channel:", err)
+		log.Error(3, "Unreadable message on websocket channel. error: %v", err)
 	}
 
 	msgType := json.Get("action").MustString()

+ 2 - 2
pkg/cmd/grafana-cli/services/services.go

@@ -63,7 +63,7 @@ func ListAllPlugins(repoUrl string) (m.PluginRepo, error) {
 	var data m.PluginRepo
 	err = json.Unmarshal(body, &data)
 	if err != nil {
-		logger.Info("Failed to unmarshal graphite response error: %v", err)
+		logger.Info("Failed to unmarshal graphite response error:", err)
 		return m.PluginRepo{}, err
 	}
 
@@ -140,7 +140,7 @@ func GetPlugin(pluginId, repoUrl string) (m.Plugin, error) {
 	var data m.Plugin
 	err = json.Unmarshal(body, &data)
 	if err != nil {
-		logger.Info("Failed to unmarshal graphite response error: %v", err)
+		logger.Info("Failed to unmarshal graphite response error:", err)
 		return m.Plugin{}, err
 	}
 

+ 1 - 1
pkg/components/imguploader/s3uploader.go

@@ -60,7 +60,7 @@ func (u *S3Uploader) Upload(ctx context.Context, imageDiskPath string) (string,
 	s3_endpoint, _ := endpoints.DefaultResolver().EndpointFor("s3", u.region)
 	key := u.path + util.GetRandomString(20) + ".png"
 	image_url := s3_endpoint.URL + "/" + u.bucket + "/" + key
-	log.Debug("Uploading image to s3", "url = ", image_url)
+	log.Debug("Uploading image to s3. url = %s", image_url)
 
 	file, err := os.Open(imageDiskPath)
 	if err != nil {

+ 1 - 1
pkg/log/log.go

@@ -103,7 +103,7 @@ func Critical(skip int, format string, v ...interface{}) {
 }
 
 func Fatal(skip int, format string, v ...interface{}) {
-	Root.Crit(fmt.Sprintf(format, v))
+	Root.Crit(fmt.Sprintf(format, v...))
 	Close()
 	os.Exit(1)
 }

+ 2 - 2
pkg/login/ext_user.go

@@ -35,7 +35,7 @@ func UpsertUser(cmd *m.UpsertUserCommand) error {
 
 		limitReached, err := quota.QuotaReached(cmd.ReqContext, "user")
 		if err != nil {
-			log.Warn("Error getting user quota", "err", err)
+			log.Warn("Error getting user quota. error: %v", err)
 			return ErrGettingUserQuota
 		}
 		if limitReached {
@@ -135,7 +135,7 @@ func updateUser(user *m.User, extUser *m.ExternalUserInfo) error {
 		return nil
 	}
 
-	log.Debug("Syncing user info", "id", user.Id, "update", updateCmd)
+	log.Debug2("Syncing user info", "id", user.Id, "update", updateCmd)
 	return bus.Dispatch(updateCmd)
 }
 

+ 3 - 3
pkg/middleware/auth_proxy.go

@@ -36,7 +36,7 @@ func initContextWithAuthProxy(ctx *m.ReqContext, orgID int64) bool {
 
 	// initialize session
 	if err := ctx.Session.Start(ctx.Context); err != nil {
-		log.Error(3, "Failed to start session", err)
+		log.Error(3, "Failed to start session. error %v", err)
 		return false
 	}
 
@@ -146,12 +146,12 @@ func initContextWithAuthProxy(ctx *m.ReqContext, orgID int64) bool {
 	if getRequestUserId(ctx) > 0 && getRequestUserId(ctx) != query.Result.UserId {
 		// remove session
 		if err := ctx.Session.Destory(ctx.Context); err != nil {
-			log.Error(3, "Failed to destroy session, err")
+			log.Error(3, "Failed to destroy session. error: %v", err)
 		}
 
 		// initialize a new session
 		if err := ctx.Session.Start(ctx.Context); err != nil {
-			log.Error(3, "Failed to start session", err)
+			log.Error(3, "Failed to start session. error: %v", err)
 		}
 	}
 

+ 1 - 1
pkg/services/alerting/notifiers/telegram.go

@@ -216,7 +216,7 @@ func appendIfPossible(message string, extra string, sizeLimit int) string {
 	if len(extra)+len(message) <= sizeLimit {
 		return message + extra
 	}
-	log.Debug("Line too long for image caption.", "value", extra)
+	log.Debug("Line too long for image caption. value: %s", extra)
 	return message
 }
 

+ 1 - 1
pkg/services/sqlstore/sqlstore.go

@@ -106,7 +106,7 @@ func (ss *SqlStore) inTransactionWithRetryCtx(ctx context.Context, callback dbTr
 	if len(sess.events) > 0 {
 		for _, e := range sess.events {
 			if err = bus.Publish(e); err != nil {
-				log.Error(3, "Failed to publish event after commit", err)
+				log.Error(3, "Failed to publish event after commit. error: %v", err)
 			}
 		}
 	}

+ 1 - 1
pkg/services/sqlstore/transactions.go

@@ -89,7 +89,7 @@ func inTransactionWithRetryCtx(ctx context.Context, callback dbTransactionFunc,
 	if len(sess.events) > 0 {
 		for _, e := range sess.events {
 			if err = bus.Publish(e); err != nil {
-				log.Error(3, "Failed to publish event after commit", err)
+				log.Error(3, "Failed to publish event after commit. error: %v", err)
 			}
 		}
 	}

+ 1 - 1
pkg/setting/setting.go

@@ -324,7 +324,7 @@ func getCommandLineProperties(args []string) map[string]string {
 		trimmed := strings.TrimPrefix(arg, "cfg:")
 		parts := strings.Split(trimmed, "=")
 		if len(parts) != 2 {
-			log.Fatal(3, "Invalid command line argument", arg)
+			log.Fatal(3, "Invalid command line argument. argument: %v", arg)
 			return nil
 		}