mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-23 17:24:18 +01:00
factory: add SetLogger API
So that we actually use the same logger as other packages when being invoked by CLI. Fixes: #520 Signed-off-by: Peng Tao <bergwolf@gmail.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"syscall"
|
||||
|
||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||
vf "github.com/kata-containers/runtime/virtcontainers/factory"
|
||||
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -146,6 +147,7 @@ func init() {
|
||||
kataLog = logrus.WithFields(logrus.Fields{
|
||||
"name": name,
|
||||
"source": "runtime",
|
||||
"arch": arch,
|
||||
"pid": os.Getpid(),
|
||||
})
|
||||
|
||||
@@ -194,6 +196,9 @@ func setExternalLoggers(logger *logrus.Entry) {
|
||||
// Set virtcontainers logger.
|
||||
vci.SetLogger(logger)
|
||||
|
||||
// Set vm factory logger.
|
||||
vf.SetLogger(logger)
|
||||
|
||||
// Set the OCI package logger.
|
||||
oci.SetLogger(logger)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user