diff options
Diffstat (limited to 'vendor/github.com/Microsoft/hcsshim/internal/wclayer/createlayer.go')
-rw-r--r-- | vendor/github.com/Microsoft/hcsshim/internal/wclayer/createlayer.go | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/createlayer.go b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/createlayer.go index d15817730..be2bc3fd6 100644 --- a/vendor/github.com/Microsoft/hcsshim/internal/wclayer/createlayer.go +++ b/vendor/github.com/Microsoft/hcsshim/internal/wclayer/createlayer.go @@ -7,17 +7,25 @@ import ( // CreateLayer creates a new, empty, read-only layer on the filesystem based on // the parent layer provided. -func CreateLayer(path, parent string) error { - title := "hcsshim::CreateLayer " - logrus.Debugf(title+"ID %s parent %s", path, parent) +func CreateLayer(path, parent string) (err error) { + title := "hcsshim::CreateLayer" + fields := logrus.Fields{ + "parent": parent, + "path": path, + } + logrus.WithFields(fields).Debug(title) + defer func() { + if err != nil { + fields[logrus.ErrorKey] = err + logrus.WithFields(fields).Error(err) + } else { + logrus.WithFields(fields).Debug(title + " - succeeded") + } + }() - err := createLayer(&stdDriverInfo, path, parent) + err = createLayer(&stdDriverInfo, path, parent) if err != nil { - err = hcserror.Errorf(err, title, "path=%s parent=%s", path, parent) - logrus.Error(err) - return err + return hcserror.New(err, title+" - failed", "") } - - logrus.Debugf(title+"- succeeded path=%s parent=%s", path, parent) return nil } |