logging: Split logging source into two fields

Don't use slash-delimited values in log fields - create two separate
log fields (`source` and `subsystem`) for clarity.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt 2018-07-26 14:08:08 +01:00
parent c59394d3ed
commit acdd0b8e68
2 changed files with 8 additions and 2 deletions

View File

@ -124,7 +124,10 @@ var hyperLog = logrus.FieldLogger(logrus.New())
// SetLogger sets the logger for hyperstart package.
func SetLogger(logger logrus.FieldLogger) {
hyperLog = logger.WithField("source", "virtcontainers/hyperstart")
hyperLog = logger.WithFields(logrus.Fields{
"source": "virtcontainers",
"subsystem": "hyperstart",
})
}
// NewHyperstart returns a new hyperstart structure.

View File

@ -132,7 +132,10 @@ var ociLog = logrus.FieldLogger(logrus.New())
// SetLogger sets the logger for oci package.
func SetLogger(logger logrus.FieldLogger) {
ociLog = logger.WithField("source", "virtcontainers/oci")
ociLog = logger.WithFields(logrus.Fields{
"source": "virtcontainers",
"subsystem": "oci",
})
}
func cmdEnvs(spec CompatOCISpec, envs []vc.EnvVar) []vc.EnvVar {