Skip to content

Commit

Permalink
Merge pull request kata-containers#1298 from jodh-intel/store-pkg-add…
Browse files Browse the repository at this point in the history
…-SetLogger

store: Add SetLogger API
  • Loading branch information
Julio Montes authored Feb 28, 2019
2 parents e8a8e0d + f540a80 commit dbfd965
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions virtcontainers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func SetLogger(ctx context.Context, logger *logrus.Entry) {
virtLog = logger.WithFields(fields)

deviceApi.SetLogger(virtLog)
store.SetLogger(virtLog)
}

// CreateSandbox is the virtcontainers sandbox creation entry point.
Expand Down
7 changes: 7 additions & 0 deletions virtcontainers/store/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ func DeleteAll() {

var storeLog = logrus.WithField("source", "virtcontainers/store")

// SetLogger sets the custom logger to be used by this package. If not called,
// the package will create its own logger.
func SetLogger(logger *logrus.Entry) {
fields := storeLog.Data
storeLog = logger.WithFields(fields)
}

// Logger returns a logrus logger appropriate for logging Store messages
func (s *Store) Logger() *logrus.Entry {
return storeLog.WithFields(logrus.Fields{
Expand Down

0 comments on commit dbfd965

Please sign in to comment.