virtcontainers: Fix structured logging in device/config package

[cherry picked from runtime commit d0dbd0485d2f4ec3760f6fa1252ded86a7709042]

Call the `device/config` package `SetLogger()` function to ensure all its log
records contain all required structured logging fields.

Signed-off-by: Julio Montes <julio.montes@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
Julio Montes 2020-06-23 00:48:35 -07:00 committed by Peng Tao
parent 422768082d
commit eed66021da
2 changed files with 8 additions and 0 deletions

View File

@ -52,6 +52,7 @@ func SetLogger(ctx context.Context, logger *logrus.Entry) {
deviceApi.SetLogger(virtLog)
compatoci.SetLogger(virtLog)
store.SetLogger(virtLog)
deviceConfig.SetLogger(virtLog)
}
// CreateSandbox is the virtcontainers sandbox creation entry point.

View File

@ -29,6 +29,13 @@ var (
pmemLog = logrus.WithField("source", "virtcontainers/device/config")
)
// SetLogger sets up a logger for this pkg
func SetLogger(logger *logrus.Entry) {
fields := pmemLog.Data
pmemLog = logger.WithFields(fields)
}
// PmemDeviceInfo returns a DeviceInfo if a loop device
// is mounted on source, and the backing file of the loop device
// has the PFN signature.