use context.GetLogger to replace logrus in listener

Signed-off-by: yuzou <zouyu7@huawei.com>
This commit is contained in:
yuzou 2016-04-15 11:17:04 +08:00
parent 05b0ab0302
commit f2686b8db4

View file

@ -3,7 +3,6 @@ package notifications
import ( import (
"net/http" "net/http"
"github.com/Sirupsen/logrus"
"github.com/docker/distribution" "github.com/docker/distribution"
"github.com/docker/distribution/context" "github.com/docker/distribution/context"
"github.com/docker/distribution/digest" "github.com/docker/distribution/digest"
@ -71,7 +70,7 @@ func (msl *manifestServiceListener) Delete(ctx context.Context, dgst digest.Dige
err := msl.ManifestService.Delete(ctx, dgst) err := msl.ManifestService.Delete(ctx, dgst)
if err == nil { if err == nil {
if err := msl.parent.listener.ManifestDeleted(msl.parent.Repository.Named(), dgst); err != nil { if err := msl.parent.listener.ManifestDeleted(msl.parent.Repository.Named(), dgst); err != nil {
logrus.Errorf("error dispatching manifest delete to listener: %v", err) context.GetLogger(ctx).Errorf("error dispatching manifest delete to listener: %v", err)
} }
} }
@ -82,7 +81,7 @@ func (msl *manifestServiceListener) Get(ctx context.Context, dgst digest.Digest,
sm, err := msl.ManifestService.Get(ctx, dgst) sm, err := msl.ManifestService.Get(ctx, dgst)
if err == nil { if err == nil {
if err := msl.parent.listener.ManifestPulled(msl.parent.Repository.Named(), sm, options...); err != nil { if err := msl.parent.listener.ManifestPulled(msl.parent.Repository.Named(), sm, options...); err != nil {
logrus.Errorf("error dispatching manifest pull to listener: %v", err) context.GetLogger(ctx).Errorf("error dispatching manifest pull to listener: %v", err)
} }
} }
@ -94,7 +93,7 @@ func (msl *manifestServiceListener) Put(ctx context.Context, sm distribution.Man
if err == nil { if err == nil {
if err := msl.parent.listener.ManifestPushed(msl.parent.Repository.Named(), sm, options...); err != nil { if err := msl.parent.listener.ManifestPushed(msl.parent.Repository.Named(), sm, options...); err != nil {
logrus.Errorf("error dispatching manifest push to listener: %v", err) context.GetLogger(ctx).Errorf("error dispatching manifest push to listener: %v", err)
} }
} }