github.com/docker/cnab-to-oci@v0.3.0-beta4/remotes/log.go (about) 1 package remotes 2 3 import ( 4 "context" 5 "encoding/json" 6 "io/ioutil" 7 8 "github.com/containerd/containerd/log" 9 "github.com/sirupsen/logrus" 10 ) 11 12 func logPayload(logger *logrus.Entry, payload interface{}) { 13 buf, err := json.MarshalIndent(payload, "", " ") 14 if err != nil { 15 return 16 } 17 logger.Debug(string(buf)) 18 } 19 20 func withMutedContext(ctx context.Context) context.Context { 21 logger := logrus.New() 22 logger.SetLevel(logrus.FatalLevel) 23 logger.SetOutput(ioutil.Discard) 24 return log.WithLogger(ctx, logrus.NewEntry(logger)) 25 }