mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-01 17:52:40 +00:00
logging: Remove unnecessary fields and use standard names
Ensure the entire codebase uses `"sandbox"` and `"container"` log fields for the sandboxID and containerID respectively. Simplify code where fields can be dropped. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
parent
3323c087c5
commit
763a1b6265
@ -264,9 +264,8 @@ func (c *Container) ID() string {
|
||||
// Logger returns a logrus logger appropriate for logging Container messages
|
||||
func (c *Container) Logger() *logrus.Entry {
|
||||
return virtLog.WithFields(logrus.Fields{
|
||||
"subsystem": "container",
|
||||
"container-id": c.id,
|
||||
"sandbox-id": c.sandboxID,
|
||||
"subsystem": "container",
|
||||
"sandbox": c.sandboxID,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -469,7 +469,7 @@ func (k *kataAgent) startProxy(sandbox *Sandbox) error {
|
||||
|
||||
proxyParams := proxyParams{
|
||||
agentURL: agentURL,
|
||||
logger: k.Logger().WithField("sandbox-id", sandbox.id),
|
||||
logger: k.Logger().WithField("sandbox", sandbox.id),
|
||||
}
|
||||
|
||||
// Start the proxy here
|
||||
@ -494,9 +494,9 @@ func (k *kataAgent) startProxy(sandbox *Sandbox) error {
|
||||
}
|
||||
|
||||
k.Logger().WithFields(logrus.Fields{
|
||||
"sandbox-id": sandbox.id,
|
||||
"proxy-pid": pid,
|
||||
"proxy-url": uri,
|
||||
"sandbox": sandbox.id,
|
||||
"proxy-pid": pid,
|
||||
"proxy-url": uri,
|
||||
}).Info("proxy started")
|
||||
|
||||
return nil
|
||||
|
@ -483,8 +483,8 @@ func (s *Sandbox) ID() string {
|
||||
// Logger returns a logrus logger appropriate for logging Sandbox messages
|
||||
func (s *Sandbox) Logger() *logrus.Entry {
|
||||
return virtLog.WithFields(logrus.Fields{
|
||||
"subsystem": "sandbox",
|
||||
"sandbox-id": s.id,
|
||||
"subsystem": "sandbox",
|
||||
"sandbox": s.id,
|
||||
})
|
||||
}
|
||||
|
||||
@ -827,7 +827,7 @@ func (s *Sandbox) storeSandbox() error {
|
||||
|
||||
// fetchSandbox fetches a sandbox config from a sandbox ID and returns a sandbox.
|
||||
func fetchSandbox(sandboxID string) (sandbox *Sandbox, err error) {
|
||||
virtLog.WithField("sandbox-id", sandboxID).Info("fetch sandbox")
|
||||
virtLog.Info("fetch sandbox")
|
||||
if sandboxID == "" {
|
||||
return nil, errNeedSandboxID
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user