Merge pull request #1298 from jodh-intel/store-pkg-add-SetLogger

store: Add SetLogger API
This commit is contained in:
Julio Montes 2019-02-28 08:52:50 -06:00 committed by GitHub
commit dbfd96583a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -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.

View File

@ -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{