mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-02 02:02:24 +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
|
// Logger returns a logrus logger appropriate for logging Container messages
|
||||||
func (c *Container) Logger() *logrus.Entry {
|
func (c *Container) Logger() *logrus.Entry {
|
||||||
return virtLog.WithFields(logrus.Fields{
|
return virtLog.WithFields(logrus.Fields{
|
||||||
"subsystem": "container",
|
"subsystem": "container",
|
||||||
"container-id": c.id,
|
"sandbox": c.sandboxID,
|
||||||
"sandbox-id": c.sandboxID,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ func (k *kataAgent) startProxy(sandbox *Sandbox) error {
|
|||||||
|
|
||||||
proxyParams := proxyParams{
|
proxyParams := proxyParams{
|
||||||
agentURL: agentURL,
|
agentURL: agentURL,
|
||||||
logger: k.Logger().WithField("sandbox-id", sandbox.id),
|
logger: k.Logger().WithField("sandbox", sandbox.id),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the proxy here
|
// Start the proxy here
|
||||||
@ -494,9 +494,9 @@ func (k *kataAgent) startProxy(sandbox *Sandbox) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
k.Logger().WithFields(logrus.Fields{
|
k.Logger().WithFields(logrus.Fields{
|
||||||
"sandbox-id": sandbox.id,
|
"sandbox": sandbox.id,
|
||||||
"proxy-pid": pid,
|
"proxy-pid": pid,
|
||||||
"proxy-url": uri,
|
"proxy-url": uri,
|
||||||
}).Info("proxy started")
|
}).Info("proxy started")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -483,8 +483,8 @@ func (s *Sandbox) ID() string {
|
|||||||
// Logger returns a logrus logger appropriate for logging Sandbox messages
|
// Logger returns a logrus logger appropriate for logging Sandbox messages
|
||||||
func (s *Sandbox) Logger() *logrus.Entry {
|
func (s *Sandbox) Logger() *logrus.Entry {
|
||||||
return virtLog.WithFields(logrus.Fields{
|
return virtLog.WithFields(logrus.Fields{
|
||||||
"subsystem": "sandbox",
|
"subsystem": "sandbox",
|
||||||
"sandbox-id": s.id,
|
"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.
|
// fetchSandbox fetches a sandbox config from a sandbox ID and returns a sandbox.
|
||||||
func fetchSandbox(sandboxID string) (sandbox *Sandbox, err error) {
|
func fetchSandbox(sandboxID string) (sandbox *Sandbox, err error) {
|
||||||
virtLog.WithField("sandbox-id", sandboxID).Info("fetch sandbox")
|
virtLog.Info("fetch sandbox")
|
||||||
if sandboxID == "" {
|
if sandboxID == "" {
|
||||||
return nil, errNeedSandboxID
|
return nil, errNeedSandboxID
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user