Commit 12c98608 by bergquist

string formating fixes

parent ff7b0d4f
...@@ -70,7 +70,7 @@ func (c *connection) readPump() { ...@@ -70,7 +70,7 @@ func (c *connection) readPump() {
func (c *connection) handleMessage(message []byte) { func (c *connection) handleMessage(message []byte) {
json, err := simplejson.NewJson(message) json, err := simplejson.NewJson(message)
if err != nil { 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() msgType := json.Get("action").MustString()
......
...@@ -63,7 +63,7 @@ func ListAllPlugins(repoUrl string) (m.PluginRepo, error) { ...@@ -63,7 +63,7 @@ func ListAllPlugins(repoUrl string) (m.PluginRepo, error) {
var data m.PluginRepo var data m.PluginRepo
err = json.Unmarshal(body, &data) err = json.Unmarshal(body, &data)
if err != nil { 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 return m.PluginRepo{}, err
} }
...@@ -140,7 +140,7 @@ func GetPlugin(pluginId, repoUrl string) (m.Plugin, error) { ...@@ -140,7 +140,7 @@ func GetPlugin(pluginId, repoUrl string) (m.Plugin, error) {
var data m.Plugin var data m.Plugin
err = json.Unmarshal(body, &data) err = json.Unmarshal(body, &data)
if err != nil { 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 return m.Plugin{}, err
} }
......
...@@ -60,7 +60,7 @@ func (u *S3Uploader) Upload(ctx context.Context, imageDiskPath string) (string, ...@@ -60,7 +60,7 @@ func (u *S3Uploader) Upload(ctx context.Context, imageDiskPath string) (string,
s3_endpoint, _ := endpoints.DefaultResolver().EndpointFor("s3", u.region) s3_endpoint, _ := endpoints.DefaultResolver().EndpointFor("s3", u.region)
key := u.path + util.GetRandomString(20) + ".png" key := u.path + util.GetRandomString(20) + ".png"
image_url := s3_endpoint.URL + "/" + u.bucket + "/" + key 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) file, err := os.Open(imageDiskPath)
if err != nil { if err != nil {
......
...@@ -103,7 +103,7 @@ func Critical(skip int, format string, v ...interface{}) { ...@@ -103,7 +103,7 @@ func Critical(skip int, format string, v ...interface{}) {
} }
func Fatal(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() Close()
os.Exit(1) os.Exit(1)
} }
......
...@@ -35,7 +35,7 @@ func UpsertUser(cmd *m.UpsertUserCommand) error { ...@@ -35,7 +35,7 @@ func UpsertUser(cmd *m.UpsertUserCommand) error {
limitReached, err := quota.QuotaReached(cmd.ReqContext, "user") limitReached, err := quota.QuotaReached(cmd.ReqContext, "user")
if err != nil { if err != nil {
log.Warn("Error getting user quota", "err", err) log.Warn("Error getting user quota. error: %v", err)
return ErrGettingUserQuota return ErrGettingUserQuota
} }
if limitReached { if limitReached {
...@@ -135,7 +135,7 @@ func updateUser(user *m.User, extUser *m.ExternalUserInfo) error { ...@@ -135,7 +135,7 @@ func updateUser(user *m.User, extUser *m.ExternalUserInfo) error {
return nil 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) return bus.Dispatch(updateCmd)
} }
......
...@@ -36,7 +36,7 @@ func initContextWithAuthProxy(ctx *m.ReqContext, orgID int64) bool { ...@@ -36,7 +36,7 @@ func initContextWithAuthProxy(ctx *m.ReqContext, orgID int64) bool {
// initialize session // initialize session
if err := ctx.Session.Start(ctx.Context); err != nil { 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 return false
} }
...@@ -146,12 +146,12 @@ func initContextWithAuthProxy(ctx *m.ReqContext, orgID int64) bool { ...@@ -146,12 +146,12 @@ func initContextWithAuthProxy(ctx *m.ReqContext, orgID int64) bool {
if getRequestUserId(ctx) > 0 && getRequestUserId(ctx) != query.Result.UserId { if getRequestUserId(ctx) > 0 && getRequestUserId(ctx) != query.Result.UserId {
// remove session // remove session
if err := ctx.Session.Destory(ctx.Context); err != nil { 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 // initialize a new session
if err := ctx.Session.Start(ctx.Context); err != nil { 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)
} }
} }
......
...@@ -216,7 +216,7 @@ func appendIfPossible(message string, extra string, sizeLimit int) string { ...@@ -216,7 +216,7 @@ func appendIfPossible(message string, extra string, sizeLimit int) string {
if len(extra)+len(message) <= sizeLimit { if len(extra)+len(message) <= sizeLimit {
return message + extra 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 return message
} }
......
...@@ -106,7 +106,7 @@ func (ss *SqlStore) inTransactionWithRetryCtx(ctx context.Context, callback dbTr ...@@ -106,7 +106,7 @@ func (ss *SqlStore) inTransactionWithRetryCtx(ctx context.Context, callback dbTr
if len(sess.events) > 0 { if len(sess.events) > 0 {
for _, e := range sess.events { for _, e := range sess.events {
if err = bus.Publish(e); err != nil { 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)
} }
} }
} }
......
...@@ -89,7 +89,7 @@ func inTransactionWithRetryCtx(ctx context.Context, callback dbTransactionFunc, ...@@ -89,7 +89,7 @@ func inTransactionWithRetryCtx(ctx context.Context, callback dbTransactionFunc,
if len(sess.events) > 0 { if len(sess.events) > 0 {
for _, e := range sess.events { for _, e := range sess.events {
if err = bus.Publish(e); err != nil { 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)
} }
} }
} }
......
...@@ -324,7 +324,7 @@ func getCommandLineProperties(args []string) map[string]string { ...@@ -324,7 +324,7 @@ func getCommandLineProperties(args []string) map[string]string {
trimmed := strings.TrimPrefix(arg, "cfg:") trimmed := strings.TrimPrefix(arg, "cfg:")
parts := strings.Split(trimmed, "=") parts := strings.Split(trimmed, "=")
if len(parts) != 2 { if len(parts) != 2 {
log.Fatal(3, "Invalid command line argument", arg) log.Fatal(3, "Invalid command line argument. argument: %v", arg)
return nil return nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment