runtime: Fix missing 'name' field on containerd-shim-v2 logs

Each Kata Containers application should generate log records with a specified
structure. Currently on containerd-shim-v2's logs, the required 'name' field
is missing. This changed its logger to append the application name on each
and every emitted entries.

Fixes #1479
Related-to: github.com/kata-containers/tests/issues/3260
Suggested-by: James O. D. Hunt <james.o.hunt@intel.com>
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
This commit is contained in:
Wainer dos Santos Moschetta 2021-03-01 15:26:11 -05:00
parent 61f0291d63
commit 21bdaaf84f

View File

@ -62,7 +62,10 @@ var (
var vci vc.VC = &vc.VCImpl{}
// shimLog is logger for shim package
var shimLog = logrus.WithField("source", "containerd-kata-shim-v2")
var shimLog = logrus.WithFields(logrus.Fields{
"source": "containerd-kata-shim-v2",
"name": "containerd-shim-v2",
})
// New returns a new shim service that can be used via GRPC
func New(ctx context.Context, id string, publisher events.Publisher) (cdshim.Shim, error) {