diff --git a/virtcontainers/api.go b/virtcontainers/api.go index 8bf3db5b4f..7072926e25 100644 --- a/virtcontainers/api.go +++ b/virtcontainers/api.go @@ -14,6 +14,7 @@ import ( deviceApi "github.com/kata-containers/runtime/virtcontainers/device/api" deviceConfig "github.com/kata-containers/runtime/virtcontainers/device/config" "github.com/kata-containers/runtime/virtcontainers/persist/fs" + "github.com/kata-containers/runtime/virtcontainers/pkg/compatoci" vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types" "github.com/kata-containers/runtime/virtcontainers/store" "github.com/kata-containers/runtime/virtcontainers/types" @@ -50,6 +51,7 @@ func SetLogger(ctx context.Context, logger *logrus.Entry) { deviceApi.SetLogger(virtLog) store.SetLogger(virtLog) + compatoci.SetLogger(virtLog) } // CreateSandbox is the virtcontainers sandbox creation entry point. diff --git a/virtcontainers/pkg/compatoci/utils.go b/virtcontainers/pkg/compatoci/utils.go index edd2201da1..0a88c22072 100644 --- a/virtcontainers/pkg/compatoci/utils.go +++ b/virtcontainers/pkg/compatoci/utils.go @@ -100,6 +100,13 @@ func containerCapabilities(s compatOCISpec) (specs.LinuxCapabilities, error) { return c, nil } +// SetLogger sets up a logger for this pkg +func SetLogger(logger *logrus.Entry) { + fields := ociLog.Data + + ociLog = logger.WithFields(fields) +} + // ContainerCapabilities return a LinuxCapabilities for virtcontainer func ContainerCapabilities(s compatOCISpec) (specs.LinuxCapabilities, error) { if s.Process == nil {