daemon: killProcessDirectly: use "WithFields" for logging

Don't chain "WithError" and "WithFields"

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-07-18 18:46:34 +02:00
parent f776cd6922
commit 0c3185a835

View File

@@ -466,7 +466,11 @@ func killProcessDirectly(ctr *container.Container) error {
return errdefs.System(err)
}
err = errNoSuchProcess{pid, syscall.SIGKILL}
log.G(context.TODO()).WithError(err).WithField("container", ctr.ID).Debug("no such process")
log.G(context.TODO()).WithFields(log.Fields{
"error": err,
"container": ctr.ID,
"pid": pid,
}).Debug("no such process")
return err
}
@@ -475,7 +479,11 @@ func killProcessDirectly(ctr *container.Container) error {
// Since we can not kill a zombie pid, add zombie check here
isZombie, err := process.Zombie(pid)
if err != nil {
log.G(context.TODO()).WithError(err).WithField("container", ctr.ID).Warn("Container state is invalid")
log.G(context.TODO()).WithFields(log.Fields{
"error": err,
"container": ctr.ID,
"pid": pid,
}).Warn("Container state is invalid")
return err
}
if isZombie {