virtcontainers: Fix structured logging in cgroups package

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

Fixes: #2782

Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
Julio Montes
2020-06-23 06:58:47 -05:00
parent 7d2a67340b
commit 0ca5983fdf
2 changed files with 9 additions and 0 deletions

View File

@@ -59,6 +59,13 @@ var (
cgroupsLogger = logrus.WithField("source", "virtcontainers/pkg/cgroups")
)
// SetLogger sets up a logger for this pkg
func SetLogger(logger *logrus.Entry) {
fields := cgroupsLogger.Data
cgroupsLogger = logger.WithFields(fields)
}
func EnableSystemdCgroup() {
systemd := true
systemdCgroup = &systemd