summaryrefslogtreecommitdiff
path: root/vendor/github.com/Microsoft/hcsshim/internal/hcs/log.go
blob: 6d03b17a224cccc39784ab9abc2c8f828c7db555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package hcs

import "github.com/sirupsen/logrus"

func logOperationBegin(ctx logrus.Fields, msg string) {
	logrus.WithFields(ctx).Debug(msg)
}

func logOperationEnd(ctx logrus.Fields, msg string, err error) {
	// Copy the log and fields first.
	log := logrus.WithFields(ctx)
	if err == nil {
		log.Debug(msg)
	} else {
		// Edit only the copied field data to avoid race conditions on the
		// write.
		log.Data[logrus.ErrorKey] = err
		log.Error(msg)
	}
}