Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
logging: Split logging source into two fields
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jodh-intel committed Jul 30, 2018
1 parent c59394d commit acdd0b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion virtcontainers/pkg/hyperstart/hyperstart.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion virtcontainers/pkg/oci/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit acdd0b8

Please sign in to comment.