Update to use placeholder

This commit is contained in:
Jack Liu 2016-03-27 00:18:11 +08:00
parent aa9fa581ec
commit cea9cca52a
5 changed files with 7 additions and 7 deletions

View File

@ -43,7 +43,7 @@ func (n *NotificationHandler) Post() {
err := json.Unmarshal(n.Ctx.Input.CopyBody(1<<32), &notification)
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)
}
}()
}

View File

@ -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")

View File

@ -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)

View File

@ -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)
}
}

View File

@ -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, ",")