diff --git a/service/notification.go b/service/notification.go index 9e9cdd97f..7f35f8b67 100644 --- a/service/notification.go +++ b/service/notification.go @@ -43,7 +43,7 @@ func (n *NotificationHandler) Post() { err := json.Unmarshal(n.Ctx.Input.CopyBody(1<<32), ¬ification) if err != nil { - log.Error("error while decoding json: ", err) + log.Errorf("error while decoding json: %v", err) return } var username, action, repo, project string @@ -51,7 +51,7 @@ func (n *NotificationHandler) Post() { for _, e := range notification.Events { matched, err = regexp.MatchString(manifestPattern, e.Target.MediaType) if err != nil { - log.Error("Failed to match the media type against pattern, error: ", err) + log.Errorf("Failed to match the media type against pattern, error: %v", err) matched = false } if matched && strings.HasPrefix(e.Request.UserAgent, "docker") { @@ -69,7 +69,7 @@ func (n *NotificationHandler) Post() { go func() { err2 := svc_utils.RefreshCatalogCache() if err2 != nil { - log.Error("Error happens when refreshing cache:", err2) + log.Errorf("Error happens when refreshing cache: %v", err2) } }() } diff --git a/service/token.go b/service/token.go index d30f44e9a..b274be3f8 100644 --- a/service/token.go +++ b/service/token.go @@ -38,7 +38,7 @@ type TokenHandler struct { func (a *TokenHandler) Get() { request := a.Ctx.Request - log.Infof("request url: " + request.URL.String()) + log.Infof("request url: %v", request.URL.String()) username, password, _ := request.BasicAuth() authenticated := authenticate(username, password) service := a.GetString("service") diff --git a/service/utils/authutils.go b/service/utils/authutils.go index d8abc917b..4c00dd579 100644 --- a/service/utils/authutils.go +++ b/service/utils/authutils.go @@ -78,7 +78,7 @@ func FilterAccess(username string, authenticated bool, a *token.ResourceActions) permission = "RW" } else { permission = "" - log.Infof("project %s does not exist, set empty permission for admin", projectName) + log.Infof("project %s does not exist, set empty permission for admin\n", projectName) } } else { permission, err = dao.GetPermission(username, projectName) diff --git a/service/utils/cache.go b/service/utils/cache.go index b44cf7031..81ec5a52b 100644 --- a/service/utils/cache.go +++ b/service/utils/cache.go @@ -34,7 +34,7 @@ func init() { var err error Cache, err = cache.NewCache("memory", `{"interval":720}`) if err != nil { - log.Error("Failed to initialize cache, error:", err) + log.Errorf("Failed to initialize cache, error:%v", err) } } diff --git a/service/utils/registryutils.go b/service/utils/registryutils.go index 153398a3b..97c4b53f8 100644 --- a/service/utils/registryutils.go +++ b/service/utils/registryutils.go @@ -60,7 +60,7 @@ func RegistryAPIGet(url, username string) ([]byte, error) { } else if response.StatusCode == http.StatusUnauthorized { authenticate := response.Header.Get("WWW-Authenticate") str := strings.Split(authenticate, " ")[1] - log.Debugf("url: " + url) + log.Debugf("url: %s", url) var service string var scope string strs := strings.Split(str, ",")