Skip to content

Commit

Permalink
Change logrus to logger where possible
Browse files Browse the repository at this point in the history
Signed-off-by: Riyaz Faizullabhoy <[email protected]>
  • Loading branch information
riyazdf committed Jul 14, 2016
1 parent 824ab1b commit 4018137
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions server/handlers/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"net/http"
"strings"

"github.com/Sirupsen/logrus"
ctxu "github.com/docker/distribution/context"
"github.com/gorilla/mux"
"golang.org/x/net/context"
Expand Down Expand Up @@ -149,7 +148,7 @@ func getHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, var
// of time.
utils.SetLastModifiedHeader(w.Header(), *lastModified)
} else {
logrus.Warnf("Got bytes out for %s's %s (checksum: %s), but missing lastModified date",
logger.Warnf("Got bytes out for %s's %s (checksum: %s), but missing lastModified date",
gun, tufRole, checksum)
}

Expand All @@ -159,15 +158,15 @@ func getHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, var

// DeleteHandler deletes all data for a GUN. A 200 responses indicates success.
func DeleteHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) error {
vars := mux.Vars(r)
gun := vars["imageName"]
logger := ctxu.GetLoggerWithField(ctx, gun, "gun")
s := ctx.Value("metaStore")
store, ok := s.(storage.MetaStore)
if !ok {
logrus.Error("500 DELETE repository: no storage exists")
logger.Error("500 DELETE repository: no storage exists")
return errors.ErrNoStorage.WithDetail(nil)
}
vars := mux.Vars(r)
gun := vars["imageName"]
logger := ctxu.GetLoggerWithField(ctx, gun, "gun")
err := store.Delete(gun)
if err != nil {
logger.Error("500 DELETE repository")
Expand All @@ -186,13 +185,12 @@ func GetKeyHandler(ctx context.Context, w http.ResponseWriter, r *http.Request)

func getKeyHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
gun, ok := vars["imageName"]
logger := ctxu.GetLoggerWithField(ctx, gun, "gun")
if !ok || gun == "" {
logrus.Info("400 GET no gun in request")
logger.Info("400 GET no gun in request")
return errors.ErrUnknown.WithDetail("no gun")
}

logger := ctxu.GetLoggerWithField(ctx, gun, "gun")

role, ok := vars["tufRole"]
if !ok || role == "" {
logger.Info("400 GET no role in request")
Expand Down

0 comments on commit 4018137

Please sign in to comment.